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


Java SQLInsertClause.executeWithKey方法代码示例

本文整理汇总了Java中com.mysema.query.sql.dml.SQLInsertClause.executeWithKey方法的典型用法代码示例。如果您正苦于以下问题:Java SQLInsertClause.executeWithKey方法的具体用法?Java SQLInsertClause.executeWithKey怎么用?Java SQLInsertClause.executeWithKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.mysema.query.sql.dml.SQLInsertClause的用法示例。


在下文中一共展示了SQLInsertClause.executeWithKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createMailLog

import com.mysema.query.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
private long createMailLog(final String launcherId, final LocalDateTime launchedAt, final String messageName,
		final LocalDateTime scheduledAt, final String from, final String subject, final String body) {
	final QMailLog a = new QMailLog("a");
	SqlInsertWithKeyCallback<Long> callback = new SqlInsertWithKeyCallback<Long>() {
		@Override
		public Long doInSqlInsertWithKeyClause(SQLInsertClause insert) {
			insert.set(a.launchedBy, launcherId);
			insert.set(a.launchedAt, launchedAt);
			insert.set(a.mailStatus, FlagCode.FALSE.code());
			insert.set(a.messageName, messageName);
			insert.set(a.scheduledAt, scheduledAt);
			insert.set(a.fromAddr, from);
			insert.set(a.subject, subject);
			insert.set(a.body, body);
			return insert.executeWithKey(Long.class);
		}
	};
	Long id = queryDslJdbcOperations.insertWithKey(a, callback);
	checkState(
			id != null,
			"failed to create QMailLog: launchedBy={0}, launchedAt={1}, mailStatus={2}, messageName={3}, scheduledAt={4}, fromAddr={5}, subject={6}, body={7}",
			launcherId, launchedAt, FlagCode.FALSE.code(), messageName, scheduledAt, from, subject, body);
	return id.longValue();
}
 
开发者ID:agwlvssainokuni,项目名称:sqlapp,代码行数:25,代码来源:MessageStoreImpl.java

示例2: createAsyncProcess

import com.mysema.query.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
private long createAsyncProcess(final String launcherId, final String description, final AsyncType asyncType,
		final LocalDateTime dtm) {
	final QAsyncProcess a = new QAsyncProcess("a");
	SqlInsertWithKeyCallback<Long> callback = new SqlInsertWithKeyCallback<Long>() {
		@Override
		public Long doInSqlInsertWithKeyClause(SQLInsertClause insert) {
			insert.set(a.launchedBy, launcherId);
			insert.set(a.description, adjustSize(description, a.description));
			insert.set(a.asyncType, asyncType.code());
			insert.set(a.asyncStatus, AsyncStatus.LAUNCHING.code());
			insert.set(a.registeredAt, dtm);
			return insert.executeWithKey(Long.class);
		}
	};
	Long id = queryDslJdbcOperations.insertWithKey(a, callback);
	checkState(
			id != null,
			"failed to create QAsyncProcess: launchedBy={0}, description={1}, asyncType={2}, asyncStatus={3}, registeredAt={4}",
			launcherId, description, asyncType.code(), AsyncStatus.LAUNCHING.code(), dtm);
	return id.longValue();
}
 
开发者ID:agwlvssainokuni,项目名称:sqlapp,代码行数:22,代码来源:AsyncProcessStoreImpl.java

示例3: create

import com.mysema.query.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
@Transactional
@Override
public Long create(BasicEx20Form form) {
	SQLInsertClause insert = qf.insert(et1);
	if (StringUtils.isNotEmpty(form.getText10())) {
		insert.set(et1.text10, form.getText10());
	}
	if (StringUtils.isNotEmpty(form.getText100())) {
		insert.set(et1.text100, form.getText100());
	}
	insert.set(et1.int64, form.getInt64());
	insert.set(et1.decimal1, form.getDecimal1());
	insert.set(et1.decimal3, form.getDecimal3());
	insert.set(et1.dt, form.getDt());
	insert.set(et1.tm, form.getTm());
	insert.set(et1.dtm, form.getDtm());
	return insert.executeWithKey(et1.id);
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:19,代码来源:BasicEx20ServiceImpl.java

示例4: create

import com.mysema.query.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
@Transactional
@Override
public Long create(BasicEx10Form form) {
	SQLInsertClause insert = qf.insert(et1);
	if (StringUtils.isNotEmpty(form.getText10())) {
		insert.set(et1.text10, form.getText10());
	}
	if (StringUtils.isNotEmpty(form.getText100())) {
		insert.set(et1.text100, form.getText100());
	}
	insert.set(et1.int64, form.getInt64());
	insert.set(et1.decimal1, form.getDecimal1());
	insert.set(et1.decimal3, form.getDecimal3());
	insert.set(et1.dt, form.getDt());
	insert.set(et1.tm, form.getTm());
	insert.set(et1.dtm, form.getDtm());
	return insert.executeWithKey(et1.id);
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:19,代码来源:BasicEx10ServiceImpl.java

示例5: createMailLog

import com.mysema.query.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
private long createMailLog(String launcherId, LocalDateTime launchedAt, String messageName,
		LocalDateTime scheduledAt, String from, String replyTo, String subject, String body) {
	SQLInsertClause insert = queryFactory.insert(ml);
	insert.set(ml.launchedBy, launcherId);
	insert.set(ml.launchedAt, launchedAt);
	insert.set(ml.mailStatus, FlagCode.FALSE.code());
	insert.set(ml.messageName, messageName);
	insert.set(ml.scheduledAt, scheduledAt);
	insert.set(ml.fromAddr, from);
	insert.set(ml.replyToAddr, replyTo);
	insert.set(ml.subject, subject);
	insert.set(ml.body, body);
	Long id = insert.executeWithKey(Long.class);
	checkState(
			id != null,
			"failed to create %s: launchedBy=%s, launchedAt=%s, mailStatus=%s, messageName=%s, scheduledAt=%s, fromAddr=%s, replyToAddr=%s, subject=%s, body=%s",
			ml.getTableName(), launcherId, launchedAt, FlagCode.FALSE.code(), messageName, scheduledAt, from,
			replyTo, subject, body);
	return id.longValue();
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:21,代码来源:MessageStoreImpl.java

示例6: createMailLog

import com.mysema.query.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
private long createMailLog(String launcherId, LocalDateTime launchedAt, String messageName,
		LocalDateTime scheduledAt, String from, String replyTo, String subject, String body) {
	SQLInsertClause insert = queryFactory.insert(ml);
	insert.set(ml.launchedBy, launcherId);
	insert.set(ml.launchedAt, launchedAt);
	insert.set(ml.mailStatus, FlagCode.FALSE.code());
	insert.set(ml.messageName, messageName);
	insert.set(ml.scheduledAt, scheduledAt);
	insert.set(ml.fromAddr, from);
	insert.set(ml.replyToAddr, replyTo);
	insert.set(ml.subject, subject);
	insert.set(ml.body, body);
	Long id = insert.executeWithKey(Long.class);
	checkState(
			id != null,
			"failed to create QMailLog: launchedBy=%s, launchedAt=%s, mailStatus=%s, messageName=%s, scheduledAt=%s, fromAddr=%s, replyToAddr=%s, subject=%s, body=%s",
			launcherId, launchedAt, FlagCode.FALSE.code(), messageName, scheduledAt, from, replyTo, subject, body);
	return id.longValue();
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:20,代码来源:MessageStoreImpl.java

示例7: create

import com.mysema.query.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
@Override
@Transactional(readOnly=false)
public Long create(InitiativeManagement initiative, Long userId) {
    SQLInsertClause insert = queryFactory.insert(qInitiative);
    populateInitiative(insert, initiative, userId, true, true);

    return insert.executeWithKey(qInitiative.id);
}
 
开发者ID:solita,项目名称:kansalaisaloite,代码行数:9,代码来源:InitiativeDaoImpl.java

示例8: insertLink

import com.mysema.query.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
private Long insertLink(Link link, Long initiativeId) {
    SQLInsertClause insert = queryFactory.insert(qInitiativeLink);
    insert.set(qInitiativeLink.initiativeId, initiativeId);
    populateLink(insert, link);

    return insert.executeWithKey(qInitiativeLink.id);
}
 
开发者ID:solita,项目名称:kansalaisaloite,代码行数:8,代码来源:InitiativeDaoImpl.java

示例9: insertInvitation

import com.mysema.query.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
private Long insertInvitation(Long initiativeId, Invitation invitation) {
    SQLInsertClause insert = queryFactory.insert(qInvitation);

    insert.set(qInvitation.initiativeId, initiativeId);
    insert.set(qInvitation.email, invitation.getEmail());
    insert.set(qInvitation.role, invitation.getRole());
    
    return insert.executeWithKey(qInvitation.id);
}
 
开发者ID:solita,项目名称:kansalaisaloite,代码行数:10,代码来源:InitiativeDaoImpl.java

示例10: register

import com.mysema.query.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
@Override
@Transactional(readOnly=false)
public Long register(String ssnHash, DateTime lastLogin, String firstNames, String lastName, LocalDate dateOfBirth) {
    SQLInsertClause insert = queryFactory
            .insert(qUser)
            .set(qUser.hash, ssnHash)
            .set(qUser.lastlogin, lastLogin)
            .set(qUser.firstnames, firstNames)
            .set(qUser.lastname, lastName)
            .set(qUser.dateofbirth, dateOfBirth)
            ;

    return insert.executeWithKey(qUser.id);
}
 
开发者ID:solita,项目名称:kansalaisaloite,代码行数:15,代码来源:UserDaoImpl.java

示例11: createSignupRequest

import com.mysema.query.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
@Transactional
@Override
public long createSignupRequest(String mailAddr, String token, LocalDateTime appliedAt) {
	SQLInsertClause insert = queryFactory.insert(a);
	insert.set(a.mailAddr, mailAddr);
	insert.set(a.token, token);
	insert.set(a.appliedAt, appliedAt);
	Long id = insert.executeWithKey(Long.class);
	checkState(id != null, "failed to create %s: mailAddr=%s, token=%s, appliedAt=%s", a.getTableName(), mailAddr,
			token, appliedAt);
	return id.longValue();
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:13,代码来源:SignupRequestHelperImpl.java

示例12: createAsyncProcess

import com.mysema.query.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
private long createAsyncProcess(String launcherId, String description, AsyncType asyncType, LocalDateTime dtm) {
	SQLInsertClause insert = queryFactory.insert(ap);
	insert.set(ap.launchedBy, launcherId);
	insert.set(ap.description, adjustSize(description, ap.description));
	insert.set(ap.asyncType, asyncType.code());
	insert.set(ap.asyncStatus, AsyncStatus.LAUNCHING.code());
	insert.set(ap.registeredAt, dtm);
	Long id = insert.executeWithKey(Long.class);
	checkState(id != null,
			"failed to create %s: launchedBy=%s, description=%s, asyncType=%s, asyncStatus=%s, registeredAt=%s",
			ap.getTableName(), launcherId, description, asyncType.code(), AsyncStatus.LAUNCHING.code(), dtm);
	return id.longValue();
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:14,代码来源:AsyncProcessStoreImpl.java

示例13: createAsyncProcess

import com.mysema.query.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
private long createAsyncProcess(String launcherId, String description, AsyncType asyncType, LocalDateTime dtm) {
	SQLInsertClause insert = queryFactory.insert(ap);
	insert.set(ap.launchedBy, launcherId);
	insert.set(ap.description, adjustSize(description, ap.description));
	insert.set(ap.asyncType, asyncType.code());
	insert.set(ap.asyncStatus, AsyncStatus.LAUNCHING.code());
	insert.set(ap.registeredAt, dtm);
	Long id = insert.executeWithKey(Long.class);
	checkState(
			id != null,
			"failed to create QAsyncProcess: launchedBy=%s, description=%s, asyncType=%s, asyncStatus=%s, registeredAt=%s",
			launcherId, description, asyncType.code(), AsyncStatus.LAUNCHING.code(), dtm);
	return id.longValue();
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:15,代码来源:AsyncProcessStoreImpl.java

示例14: create

import com.mysema.query.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
@Transactional
// Not that initiatives created with this function cannot be updated with updateForTesting() for some reason.
// Other issues might also occur...?
public Long create(InitiativeDraft initiativeDraft) {
    LocalDate startDate;
    LocalDate endDate;
    if (initiativeDraft.startTime != null) {
        startDate = initiativeDraft.startTime;
        endDate = initiativeDraft.endTime;
    }
    else if (initiativeDraft.running == null || !initiativeDraft.running) {
        startDate = getDbCurrentTime().minusDays(2).toLocalDate();
        endDate = startDate;
    }
    else {
        startDate = getDbCurrentTime().minusDays(1).toLocalDate();
        endDate = startDate.plusDays(2);
    }

    SQLInsertClause insert = queryFactory.insert(qInitiative)
            .set(qInitiative.startdate, startDate)
            .set(qInitiative.acceptanceidentifier, initiativeDraft.acceptedByOm ? "acceptance number" : null)
            .set(qInitiative.enddate, endDate)
            .set(qInitiative.state, initiativeDraft.state)
            .set(qInitiative.modifierId, initiativeDraft.representativeId)
            .set(qInitiative.supportcount, initiativeDraft.supportCount)
            .set(qInitiative.externalsupportcount, initiativeDraft.externalSupportCount)
            .set(qInitiative.supportstatementsinweb, initiativeDraft.externalSupportCount > 0)
            .set(qInitiative.proposaltype, ProposalType.LAW)
            .set(qInitiative.nameFi, initiativeDraft.name)
            .set(qInitiative.rationaleFi, "rationale")
            .set(qInitiative.proposalFi, "proposal")
            .set(qInitiative.primarylanguage, LanguageCode.FI);

    if (initiativeDraft.hasDenormalizedSupportCounts) {
        insert.set(qInitiative.supportCountData, InitiativeDraft.DEFAULT_DENORMALIZED_SUPPORTCOUNT_DATA);
    }

    Long initiativeId = insert.executeWithKey(qInitiative.id);

    SQLInsertClause authorInsert = queryFactory.insert(initiativeAuthor)
            .set(initiativeAuthor.userId, initiativeDraft.representativeId)
            .set(initiativeAuthor.initiativeId, initiativeId)
            .set(initiativeAuthor.lastname, randomAlphabetic(10))
            .set(initiativeAuthor.firstnames, randomAlphabetic(10))
            .set(initiativeAuthor.homemunicipalityFi, "Helsinki")
            .set(initiativeAuthor.homemunicipalitySv, "Helsinki")
            .set(initiativeAuthor.role, AuthorRole.REPRESENTATIVE)
            .set(initiativeAuthor.confirmed, DateTime.now())
            .set(initiativeAuthor.initiator, false)
            .set(initiativeAuthor.phone, "040");

    if (initiativeDraft.representativeEmail.isPresent()) {
        authorInsert.set(initiativeAuthor.email, initiativeDraft.representativeEmail.get());
    }
    authorInsert.execute();

    return initiativeId;

}
 
开发者ID:solita,项目名称:kansalaisaloite,代码行数:61,代码来源:TestHelper.java

示例15: create

import com.mysema.query.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
@Transactional
@Override
public Long create(AppliedEx20Form form) {

	SQLInsertClause insert = qf.insert(et1);
	if (StringUtils.isNotEmpty(form.getText10())) {
		insert.set(et1.text10, form.getText10());
	}
	if (StringUtils.isNotEmpty(form.getText100())) {
		insert.set(et1.text100, form.getText100());
	}
	insert.set(et1.int64, form.getInt64());
	insert.set(et1.decimal1, form.getDecimal1());
	insert.set(et1.decimal3, form.getDecimal3());
	insert.set(et1.dt, form.getDt());
	insert.set(et1.tm, form.getTm());
	insert.set(et1.dtm, form.getDtm());
	Long id = insert.executeWithKey(et1.id);

	SQLInsertClause insertSub = qf.insert(et2);
	for (AppliedEx20SubForm sf : form.getItem()) {
		insertSub.set(et2.parentId, id);
		if (StringUtils.isNotEmpty(sf.getText10())) {
			insertSub.set(et2.text10, sf.getText10());
		}
		if (StringUtils.isNotEmpty(sf.getText100())) {
			insertSub.set(et2.text100, sf.getText100());
		}
		insertSub.set(et2.int64, sf.getInt64());
		insertSub.set(et2.decimal1, sf.getDecimal1());
		insertSub.set(et2.decimal3, sf.getDecimal3());
		insertSub.set(et2.dt, sf.getDt());
		insertSub.set(et2.tm, sf.getTm());
		insertSub.set(et2.dtm, sf.getDtm());
		insertSub.addBatch();
	}
	long count = insertSub.execute();
	if (count != form.getItem().size()) {
		throw new IllegalStateException();
	}

	return id;
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:44,代码来源:AppliedEx20ServiceImpl.java


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