当前位置: 首页>>代码示例>>Java>>正文


Java SQLDeleteClause类代码示例

本文整理汇总了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();
        }
    });
}
 
开发者ID:edgar615,项目名称:javase-study,代码行数:18,代码来源:DeleteTransaction.java

示例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();
}
 
开发者ID:solita,项目名称:kansalaisaloite,代码行数:27,代码来源:InitiativeDaoImpl.java

示例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);
    }
}
 
开发者ID:solita,项目名称:kansalaisaloite,代码行数:17,代码来源:InitiativeDaoImpl.java

示例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();
		}
	});
}
 
开发者ID:u2ware,项目名称:springfield,代码行数:11,代码来源:JdbcQueryDslExecutor.java

示例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();
}
 
开发者ID:solita,项目名称:kansalaisaloite,代码行数:28,代码来源:InitiativeDaoImpl.java

示例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);
    }
}
 
开发者ID:solita,项目名称:kansalaisaloite,代码行数:11,代码来源:InitiativeDaoImpl.java

示例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
}
 
开发者ID:solita,项目名称:kansalaisaloite,代码行数:13,代码来源:InitiativeDaoImpl.java

示例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
}
 
开发者ID:solita,项目名称:kansalaisaloite,代码行数:13,代码来源:InitiativeDaoImpl.java

示例9: getDeleteCluase

import com.mysema.query.sql.dml.SQLDeleteClause; //导入依赖的package包/类
public SQLDeleteClause getDeleteCluase(RelationalPath path) {
    return new SQLDeleteClause(connection, MySQLTemplates.DEFAULT, path);
}
 
开发者ID:DemonWav,项目名称:EctoTokens,代码行数:4,代码来源:DatabaseManager.java

示例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();
}
 
开发者ID:DemonWav,项目名称:EctoTokens,代码行数:7,代码来源:CouponManager.java

示例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();
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:6,代码来源:PublisherTransaction.java

示例12: delete

import com.mysema.query.sql.dml.SQLDeleteClause; //导入依赖的package包/类
protected SQLDeleteClause delete(RelationalPath<?> entity) {
	return new SQLDeleteClause(connection, templates, entity);
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:4,代码来源:QueryDSLTransaction.java


注:本文中的com.mysema.query.sql.dml.SQLDeleteClause类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。