本文整理汇总了Java中com.mysema.query.sql.dml.SQLUpdateClause.set方法的典型用法代码示例。如果您正苦于以下问题:Java SQLUpdateClause.set方法的具体用法?Java SQLUpdateClause.set怎么用?Java SQLUpdateClause.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mysema.query.sql.dml.SQLUpdateClause
的用法示例。
在下文中一共展示了SQLUpdateClause.set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateUnsentInvitation
import com.mysema.query.sql.dml.SQLUpdateClause; //导入方法依赖的package包/类
private void updateUnsentInvitation(Long initiativeId, Invitation invitation) {
if (invitation.getSent() == null) {
Long invitationId = invitation.getId();
Assert.notNull(invitationId, "invitation.id");
SQLUpdateClause update = queryFactory
.update(qInvitation)
.where(
qInvitation.id.eq(invitationId),
qInvitation.initiativeId.eq(initiativeId) // Defensive...
);
update.set(qInvitation.email, invitation.getEmail());
if (update.execute() != 1) {
throw new NotFoundException(qInitiativeLink.getTableName(), invitationId);
}
}
}
示例2: updateInvitationSent
import com.mysema.query.sql.dml.SQLUpdateClause; //导入方法依赖的package包/类
@Override
@Transactional(readOnly=false)
public void updateInvitationSent(Long initiativeId, Long invitationId, String invitationCode) {
Assert.notNull(initiativeId, "initiativeId");
Assert.notNull(invitationId, "invitationId");
Assert.notNull(invitationCode, "invitationCode");
SQLUpdateClause update = queryFactory
.update(qInvitation)
.where(
qInvitation.id.eq(invitationId),
qInvitation.initiativeId.eq(initiativeId), // Defensive...
qInvitation.sent.isNull()
);
update.set(qInvitation.sent, CURRENT_TIME);
update.set(qInvitation.invitationcode, invitationCode);
if (update.execute() != 1) {
throw new NotFoundException(qInvitation.getTableName(), invitationId);
}
}
示例3: populate
import com.mysema.query.sql.dml.SQLUpdateClause; //导入方法依赖的package包/类
/**
* 因为需要忽略createdTime、updatedTime,所以并没有直接使用 updateClause.populate(domain)或updateClause.populate(domain, DefaultMapper.WITH_NULL_BINDINGS)来实现set
*
* @param updateClause
* @param obj
* @param mapper
*/
public void populate(SQLUpdateClause updateClause, T obj, DefaultMapper mapper) {
Collection<? extends Path<?>> primaryKeyColumns = pathBase.getPrimaryKey() != null
? pathBase.getPrimaryKey().getLocalColumns()
: Collections.<Path<?>>emptyList();
Map<Path<?>, Object> values = mapper.createMap(pathBase, obj);
for (Map.Entry<Path<?>, Object> entry : values.entrySet()) {
if (!primaryKeyColumns.contains(entry.getKey()) && !ignoreColumns.contains(entry.getKey().getMetadata().getName())) {
updateClause.set((Path) entry.getKey(), entry.getValue());
}
}
}
示例4: loginRegisteredUser
import com.mysema.query.sql.dml.SQLUpdateClause; //导入方法依赖的package包/类
@Override
@Transactional(readOnly=false)
public User loginRegisteredUser(String ssnHash) {
User user = getRegisteredUser(ssnHash);
if (user != null) {
SQLUpdateClause update = queryFactory.update(qUser);
update.set(qUser.lastlogin, new DateTime());
update.where(qUser.id.eq(user.getId()));
update.execute();
}
return user;
}
示例5: setUserRoles
import com.mysema.query.sql.dml.SQLUpdateClause; //导入方法依赖的package包/类
@Override
public void setUserRoles(Long userId, boolean vrk, boolean om) {
Assert.notNull(userId, "userId");
SQLUpdateClause update = queryFactory.update(qUser);
update.set(qUser.vrk, vrk);
update.set(qUser.om, om);
update.where(qUser.id.eq(userId));
update.execute();
}
示例6: changePassword
import com.mysema.query.sql.dml.SQLUpdateClause; //导入方法依赖的package包/类
@Transactional
@Override
public boolean changePassword(String loginId, String password) {
SQLUpdateClause update = queryFactory.update(u);
update.set(u.password, password);
update.set(u.lockVersion, u.lockVersion.add(1));
update.set(u.updatedAt, DateTimeExpression.currentTimestamp(LocalDateTime.class));
update.where(u.loginId.eq(loginId), u.deletedFlg.eq(DeletedFlag.NOT_DELETED.code()));
return update.execute() == 1L;
}
示例7: saveAndUnlock
import com.mysema.query.sql.dml.SQLUpdateClause; //导入方法依赖的package包/类
@Override
public void saveAndUnlock(final String numberName, final long current) {
SQLUpdateClause update = queryFactory.update(nm);
update.set(nm.currentValue, current);
update.set(nm.lockVersion, nm.lockVersion.add(1));
update.where(nm.name.eq(numberName));
long count = update.execute();
checkState(count == 1, "Failed to update %s: name=%s, currentValue=%s, count=%s", nm.getTableName(),
numberName, current, count);
}
示例8: finishMessage
import com.mysema.query.sql.dml.SQLUpdateClause; //导入方法依赖的package包/类
@Override
public void finishMessage(long messageId) {
SQLUpdateClause update = queryFactory.update(ml);
update.set(ml.mailStatus, FlagCode.TRUE.code());
update.set(ml.sentAt, bizDateTime.now());
update.set(ml.lockVersion, ml.lockVersion.add(1));
update.where(ml.id.eq(messageId));
long count = update.execute();
checkState(count == 1L, "failed to update %s: id=%s, mailStatus=%s", ml.getTableName(), messageId,
FlagCode.TRUE.code());
long c = queryFactory.delete(mq).where(mq.mailId.eq(messageId)).execute();
checkState(c == 1L, "failed to delete %s: mailId=%s", mq.getTableName(), messageId);
}
示例9: updateToLaunched
import com.mysema.query.sql.dml.SQLUpdateClause; //导入方法依赖的package包/类
@Transactional("jtaTransactionManager")
public void updateToLaunched(long asyncId, LocalDateTime dtm) {
SQLUpdateClause update = queryFactory.update(ap);
update.set(ap.asyncStatus, AsyncStatus.LAUNCHED.code());
update.set(ap.launchedAt, dtm);
update.set(ap.updatedAt, currentTimestamp(LocalDateTime.class));
update.set(ap.lockVersion, ap.lockVersion.add(1));
update.where(ap.id.eq(asyncId));
long count = update.execute();
checkState(count == 1L, "failed to update %s: id=%s, asyncStatus=%s, launchedAt=%s, count=%s",
ap.getTableName(), asyncId, AsyncStatus.LAUNCHED.code(), dtm, count);
}
示例10: updateToProcessing
import com.mysema.query.sql.dml.SQLUpdateClause; //导入方法依赖的package包/类
@Transactional(propagation = REQUIRES_NEW)
@Override
public void updateToProcessing(long asyncId, LocalDateTime dtm) {
SQLUpdateClause update = queryFactory.update(ap);
update.set(ap.asyncStatus, AsyncStatus.PROCESSING.code());
update.set(ap.startedAt, dtm);
update.set(ap.updatedAt, currentTimestamp(LocalDateTime.class));
update.set(ap.lockVersion, ap.lockVersion.add(1));
update.where(ap.id.eq(asyncId));
long count = update.execute();
checkState(count == 1L, "failed to update %s: id=%s, asyncStatus=%s, startedAt=%s, count=%s",
ap.getTableName(), asyncId, AsyncStatus.PROCESSING.code(), dtm, count);
}
示例11: finishAsyncProcess
import com.mysema.query.sql.dml.SQLUpdateClause; //导入方法依赖的package包/类
private void finishAsyncProcess(long asyncId, LocalDateTime dtm, AsyncStatus status) {
SQLUpdateClause update = queryFactory.update(ap);
update.set(ap.asyncStatus, status.code());
update.set(ap.finishedAt, dtm);
update.set(ap.updatedAt, currentTimestamp(LocalDateTime.class));
update.set(ap.lockVersion, ap.lockVersion.add(1));
update.where(ap.id.eq(asyncId));
long count = update.execute();
checkState(count == 1L, "failed to update %s: id=%s, asyncStatus=%s, finishedAt=%s, count=%s",
ap.getTableName(), asyncId, status.code(), dtm, count);
}
示例12: saveAndUnlock
import com.mysema.query.sql.dml.SQLUpdateClause; //导入方法依赖的package包/类
@Override
public void saveAndUnlock(final String numberName, final long current) {
SQLUpdateClause update = queryFactory.update(nm);
update.set(nm.currentValue, current);
update.set(nm.lockVersion, nm.lockVersion.add(1));
update.where(nm.name.eq(numberName), nm.deletedFlg.eq(DeletedFlag.NOT_DELETED.code()));
long count = update.execute();
checkState(count == 1, "Failed to update %s: name=%s, currentValue=%s, count=%s", nm.getTableName(),
numberName, current, count);
}
示例13: finishMessage
import com.mysema.query.sql.dml.SQLUpdateClause; //导入方法依赖的package包/类
@Override
public void finishMessage(long messageId) {
SQLUpdateClause update = queryFactory.update(ml);
update.set(ml.mailStatus, FlagCode.TRUE.code());
update.set(ml.sentAt, bizDateTime.now());
update.set(ml.lockVersion, ml.lockVersion.add(1));
update.where(ml.id.eq(messageId), ml.deletedFlg.eq(DeletedFlag.NOT_DELETED.code()));
long count = update.execute();
checkState(count == 1L, "failed to update QMailLog: id=%s, mailStatus=%s", messageId, FlagCode.TRUE.code());
long c = queryFactory.delete(mq)
.where(mq.mailId.eq(messageId), mq.deletedFlg.eq(DeletedFlag.NOT_DELETED.code())).execute();
checkState(c == 1L, "failed to delete QMailQueue: mailId=%s", messageId);
}
示例14: updateToLaunched
import com.mysema.query.sql.dml.SQLUpdateClause; //导入方法依赖的package包/类
@Transactional("jtaTransactionManager")
public void updateToLaunched(long asyncId, LocalDateTime dtm) {
SQLUpdateClause update = queryFactory.update(ap);
update.set(ap.asyncStatus, AsyncStatus.LAUNCHED.code());
update.set(ap.launchedAt, dtm);
update.set(ap.updatedAt, currentTimestamp(LocalDateTime.class));
update.set(ap.lockVersion, ap.lockVersion.add(1));
update.where(ap.id.eq(asyncId));
update.where(ap.deletedFlg.eq(DeletedFlag.NOT_DELETED.code()));
long count = update.execute();
checkState(count == 1L, "failed to update QAsyncProcess: id=%s, asyncStatus=%s, launchedAt=%s, count=%s",
asyncId, AsyncStatus.LAUNCHED.code(), dtm, count);
}
示例15: updateToProcessing
import com.mysema.query.sql.dml.SQLUpdateClause; //导入方法依赖的package包/类
@Transactional(propagation = REQUIRES_NEW)
@Override
public void updateToProcessing(long asyncId, LocalDateTime dtm) {
SQLUpdateClause update = queryFactory.update(ap);
update.set(ap.asyncStatus, AsyncStatus.PROCESSING.code());
update.set(ap.startedAt, dtm);
update.set(ap.updatedAt, currentTimestamp(LocalDateTime.class));
update.set(ap.lockVersion, ap.lockVersion.add(1));
update.where(ap.id.eq(asyncId));
update.where(ap.deletedFlg.eq(DeletedFlag.NOT_DELETED.code()));
long count = update.execute();
checkState(count == 1L, "failed to update QAsyncProcess: id=%s, asyncStatus=%s, startedAt=%s, count=%s",
asyncId, AsyncStatus.PROCESSING.code(), dtm, count);
}