本文整理汇总了Java中com.mysema.query.sql.dml.SQLDeleteClause类的典型用法代码示例。如果您正苦于以下问题:Java SQLDeleteClause类的具体用法?Java SQLDeleteClause怎么用?Java SQLDeleteClause使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SQLDeleteClause类属于com.mysema.query.sql.dml包,在下文中一共展示了SQLDeleteClause类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.mysema.query.sql.dml.SQLDeleteClause; //导入依赖的package包/类
@Override
public Long execute() {
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
return jdbcTemplate.execute(new ConnectionCallback<Long>() {
@Override
public Long doInConnection(Connection connection) throws SQLException, DataAccessException {
final SQLDeleteClause deleteClause = new SQLDeleteClause(connection, configuration, pathBase);
for (BooleanExpression expression : QueryExampleHelper.getExpressions(pathBase, example)) {
deleteClause.where(expression);
}
for (SQLBindings sqlBindings : deleteClause.getSQL()) {
LOGGER.debug("SQL: {} \nparams: {}", sqlBindings.getSQL(), sqlBindings.getBindings());
}
return deleteClause.execute();
}
});
}
示例2: updateLinks
import com.mysema.query.sql.dml.SQLDeleteClause; //导入依赖的package包/类
@Override
@Transactional(readOnly=false)
public void updateLinks(Long initiativeId, List<Link> links) {
List<Long> linkIds = Lists.newArrayList();
for (Link link : links) {
if (!link.isDeleted()) {
Long linkId = link.getId();
if (linkId != null) {
updateLink(link, initiativeId);
} else {
linkId = insertLink(link, initiativeId);
}
linkIds.add(linkId);
}
}
// Delete other (i.e. removed) links
SQLDeleteClause delete = queryFactory
.delete(qInitiativeLink)
.where(qInitiativeLink.initiativeId.eq(initiativeId));
if (!linkIds.isEmpty()) {
delete.where(qInitiativeLink.id.notIn(linkIds));
}
delete.execute();
}
示例3: removeInvitation
import com.mysema.query.sql.dml.SQLDeleteClause; //导入依赖的package包/类
@Override
@Transactional(readOnly=false)
public void removeInvitation(Long initiativeId, String invitationCode) {
Assert.notNull(initiativeId, "initiativeId");
Assert.notNull(invitationCode, "invitationCode");
SQLDeleteClause delete = queryFactory
.delete(qInvitation)
.where(qInvitation.initiativeId.eq(initiativeId),
qInvitation.invitationcode.eq(invitationCode),
qInvitation.sent.isNotNull());
if (delete.execute() != 1) {
throw new NotFoundException(qInvitation.getTableName(), initiativeId + ":" + invitationCode);
}
}
示例4: deleteAll
import com.mysema.query.sql.dml.SQLDeleteClause; //导入依赖的package包/类
@Override
public long deleteAll(final Predicate predicate) {
return jdbcTemplate.execute(new ConnectionCallback<Long>(){
public Long doInConnection(Connection con) throws SQLException, DataAccessException {
SQLDeleteClause query = new SQLDeleteClause(con, dialect, null);
applyWhere(query, predicate);
return query.execute();
}
});
}
示例5: updateInvitations
import com.mysema.query.sql.dml.SQLDeleteClause; //导入依赖的package包/类
private void updateInvitations(Long initiativeId, List<Invitation> unsentInvitations, AuthorRole role) {
List<Long> invitationIds = Lists.newArrayList();
for (Invitation invitation : unsentInvitations) {
if (!invitation.isDeleted()) {
invitation.assignRole(role);
Long invitationId = invitation.getId();
if (invitationId != null) {
updateUnsentInvitation(initiativeId, invitation);
} else {
invitationId = insertInvitation(initiativeId, invitation);
}
invitationIds.add(invitationId);
}
}
// Delete other (i.e. removed) unsent invitations
SQLDeleteClause delete = queryFactory
.delete(qInvitation)
.where(qInvitation.initiativeId.eq(initiativeId),
qInvitation.role.eq(role),
qInvitation.sent.isNull());
if (!invitationIds.isEmpty()) {
delete.where(qInvitation.id.notIn(invitationIds));
}
delete.execute();
}
示例6: deleteAuthor
import com.mysema.query.sql.dml.SQLDeleteClause; //导入依赖的package包/类
@Override
@Transactional(readOnly=false)
public void deleteAuthor(Long initiativeId, Long userId) {
SQLDeleteClause delete = queryFactory.delete(qAuthor)
.where(qAuthor.initiativeId.eq(initiativeId), qAuthor.userId.eq(userId));
if (delete.execute() != 1) {
throw new NotFoundException("author", initiativeId + ":" + userId);
}
}
示例7: removeInvitations
import com.mysema.query.sql.dml.SQLDeleteClause; //导入依赖的package包/类
@Override
@Transactional(readOnly=false)
public void removeInvitations(Long initiativeId) {
Assert.notNull(initiativeId, "initiativeId");
//remove all remaining invitations from initiative: unsent, unanswered and expired
SQLDeleteClause delete = queryFactory
.delete(qInvitation)
.where(qInvitation.initiativeId.eq(initiativeId));
delete.execute(); // no need to check removed count, since it can be anything between 0 and n
}
示例8: removeUnconfirmedAuthors
import com.mysema.query.sql.dml.SQLDeleteClause; //导入依赖的package包/类
@Override
@Transactional(readOnly=false)
public void removeUnconfirmedAuthors(Long initiativeId) {
Assert.notNull(initiativeId, "initiativeId");
SQLDeleteClause delete = queryFactory
.delete(qAuthor)
.where(qAuthor.initiativeId.eq(initiativeId),
qAuthor.confirmed.isNull());
delete.execute(); // no need to check removed count, since it can be anything between 0 and n
}
示例9: getDeleteCluase
import com.mysema.query.sql.dml.SQLDeleteClause; //导入依赖的package包/类
public SQLDeleteClause getDeleteCluase(RelationalPath path) {
return new SQLDeleteClause(connection, MySQLTemplates.DEFAULT, path);
}
示例10: deleteCoupon
import com.mysema.query.sql.dml.SQLDeleteClause; //导入依赖的package包/类
public void deleteCoupon(String name) {
QCoupon c = QCoupon.coupon;
SQLDeleteClause clause = DatabaseManager.getInstance().getDeleteCluase(c);
clause.where(c.couponName.eq(name)).execute();
}
示例11: executePerformDelete
import com.mysema.query.sql.dml.SQLDeleteClause; //导入依赖的package包/类
private Object executePerformDelete(PerformDelete query) {
SQLDeleteClause delete = delete(query.getEntity());
return delete.where(query.getMetadata().getWhere()).execute();
}
示例12: delete
import com.mysema.query.sql.dml.SQLDeleteClause; //导入依赖的package包/类
protected SQLDeleteClause delete(RelationalPath<?> entity) {
return new SQLDeleteClause(connection, templates, entity);
}