本文整理汇总了Java中com.querydsl.sql.dml.SQLInsertClause.execute方法的典型用法代码示例。如果您正苦于以下问题:Java SQLInsertClause.execute方法的具体用法?Java SQLInsertClause.execute怎么用?Java SQLInsertClause.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.querydsl.sql.dml.SQLInsertClause
的用法示例。
在下文中一共展示了SQLInsertClause.execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: insertFacility
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
@TransactionalWrite
public long insertFacility(Facility facility, long facilityId) {
checkNotNull(facility, "facility");
facility.normalize();
SQLInsertClause insert = insertFacility();
insert.set(qFacility.id, facilityId);
populate(facility, insert);
insert.execute();
insertAliases(facilityId, facility.aliases);
insertPorts(facilityId, facility.ports);
updateServices(facilityId, facility.services);
updatePaymentMethods(facilityId, facility.paymentInfo.paymentMethods);
insertPricing(facilityId, facility.pricingMethod.getPricing(facility));
insertUnavailableCapacity(facilityId, facility.unavailableCapacities);
// History updated
final DateTime currentDate = DateTime.now();
facilityHistoryRepository.updateStatusHistory(currentDate, facilityId, facility.status, facility.statusDescription);
facilityHistoryRepository.updateCapacityHistory(currentDate, facilityId, facility.builtCapacity, facility.unavailableCapacities);
return facilityId;
}
示例2: insertPricing
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
private void insertPricing(long facilityId, List<Pricing> pricing) {
if (pricing != null && !pricing.isEmpty()) {
SQLInsertClause insert = queryFactory.insert(qPricing);
for (Pricing price : pricing) {
insert.set(qPricing.facilityId, facilityId)
.set(qPricing.capacityType, price.capacityType)
.set(qPricing.usage, price.usage)
.set(qPricing.maxCapacity, price.maxCapacity)
.set(qPricing.dayType, price.dayType)
.set(qPricing.fromTime, price.time.from)
.set(qPricing.untilTime, price.time.until);
pricingPriceMapping.populate(price.price, insert);
insert.addBatch();
}
insert.execute();
}
}
示例3: insertUtilizations
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
@TransactionalWrite
@Override
public void insertUtilizations(List<Utilization> utilizations) {
if (utilizations.isEmpty()) {
return;
}
SQLInsertClause insertBatch = queryFactory.insert(qUtilization);
utilizations.forEach(u -> {
insertBatch.set(qUtilization.facilityId, u.facilityId);
insertBatch.set(qUtilization.capacityType, u.capacityType);
insertBatch.set(qUtilization.usage, u.usage);
insertBatch.set(qUtilization.ts, u.timestamp);
insertBatch.set(qUtilization.spacesAvailable, u.spacesAvailable);
insertBatch.set(qUtilization.capacity, u.capacity);
insertBatch.addBatch();
});
insertBatch.execute();
}
示例4: savePredictionHistory
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
private void savePredictionHistory(Long predictorId, DateTime start, List<Prediction> predictions) {
if (predictions.isEmpty()) {
return;
}
SQLInsertClause insert = queryFactory.insert(qPredictionHistory);
predictions.forEach(p -> insert
.set(qPredictionHistory.predictorId, predictorId)
.set(qPredictionHistory.forecastDistanceInMinutes, ((int) new Duration(start, p.timestamp).getStandardMinutes()))
.set(qPredictionHistory.ts, p.timestamp)
.set(qPredictionHistory.spacesAvailable, p.spacesAvailable)
.addBatch());
try {
insert.execute();
} catch (QueryException e) {
// XXX: upsert would be a better way to ignore primary key conflicts, but this shall do for now
log.error("Failed save prediction history for predictor " + predictorId, e);
}
}
示例5: insertHistoricalLocation
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
public boolean insertHistoricalLocation(HistoricalLocation h) throws NoSuchEntityException, IncompleteEntityException {
Thing t = h.getThing();
entityExistsOrCreate(t);
SQLQueryFactory qFactory = pm.createQueryFactory();
QHistLocations qhl = QHistLocations.histLocations;
SQLInsertClause insert = qFactory.insert(qhl);
insert.set(qhl.time, new Timestamp(h.getTime().getDateTime().getMillis()));
insert.set(qhl.thingId, (UUID) h.getThing().getId().getValue());
UUID generatedId = insert.executeWithKey(qhl.id);
LOGGER.info("Inserted HistoricalLocation. Created id = {}.", generatedId);
h.setId(new UuidId(generatedId));
EntitySet<Location> locations = h.getLocations();
for (Location l : locations) {
entityExistsOrCreate(l);
UUID lId = (UUID) l.getId().getValue();
QLocationsHistLocations qlhl = QLocationsHistLocations.locationsHistLocations;
insert = qFactory.insert(qlhl);
insert.set(qlhl.histLocationId, generatedId);
insert.set(qlhl.locationId, lId);
insert.execute();
LOGGER.debug("Linked Location {} to HistoricalLocation {}.", lId, generatedId);
}
return true;
}
示例6: insertHistoricalLocation
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
public boolean insertHistoricalLocation(HistoricalLocation h) throws NoSuchEntityException, IncompleteEntityException {
Thing t = h.getThing();
entityExistsOrCreate(t);
SQLQueryFactory qFactory = pm.createQueryFactory();
QHistLocations qhl = QHistLocations.histLocations;
SQLInsertClause insert = qFactory.insert(qhl);
insert.set(qhl.time, new Timestamp(h.getTime().getDateTime().getMillis()));
insert.set(qhl.thingId, (Long) h.getThing().getId().getValue());
Long generatedId = insert.executeWithKey(qhl.id);
LOGGER.info("Inserted HistoricalLocation. Created id = {}.", generatedId);
h.setId(new LongId(generatedId));
EntitySet<Location> locations = h.getLocations();
for (Location l : locations) {
entityExistsOrCreate(l);
Long lId = (Long) l.getId().getValue();
QLocationsHistLocations qlhl = QLocationsHistLocations.locationsHistLocations;
insert = qFactory.insert(qlhl);
insert.set(qlhl.histLocationId, generatedId);
insert.set(qlhl.locationId, lId);
insert.execute();
LOGGER.debug("Linked Location {} to HistoricalLocation {}.", lId, generatedId);
}
return true;
}
示例7: insertHistoricalLocation
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
public boolean insertHistoricalLocation(HistoricalLocation h) throws NoSuchEntityException, IncompleteEntityException {
Thing t = h.getThing();
entityExistsOrCreate(t);
SQLQueryFactory qFactory = pm.createQueryFactory();
QHistLocations qhl = QHistLocations.histLocations;
SQLInsertClause insert = qFactory.insert(qhl);
insert.set(qhl.time, new Timestamp(h.getTime().getDateTime().getMillis()));
insert.set(qhl.thingId, (String) h.getThing().getId().getValue());
String generatedId = insert.executeWithKey(qhl.id);
LOGGER.info("Inserted HistoricalLocation. Created id = {}.", generatedId);
h.setId(new StringId(generatedId));
EntitySet<Location> locations = h.getLocations();
for (Location l : locations) {
entityExistsOrCreate(l);
String lId = (String) l.getId().getValue();
QLocationsHistLocations qlhl = QLocationsHistLocations.locationsHistLocations;
insert = qFactory.insert(qlhl);
insert.set(qlhl.histLocationId, generatedId);
insert.set(qlhl.locationId, lId);
insert.execute();
LOGGER.debug("Linked Location {} to HistoricalLocation {}.", lId, generatedId);
}
return true;
}
示例8: flushDateBatch
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
private void flushDateBatch(final List<Date> dateBatch, final Connection connection,
final Configuration configuration) {
QDateSequence dateSequence = QDateSequence.dateSequence;
SQLInsertClause insertClause = new SQLInsertClause(connection, configuration, dateSequence);
for (Date date : dateBatch) {
insertClause.set(dateSequence.date, date).addBatch();
}
insertClause.execute();
dateBatch.clear();
}
示例9: insertPorts
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
private void insertPorts(long facilityId, Map<Integer, Port> addedPorts) {
if (addedPorts != null && !addedPorts.isEmpty()) {
SQLInsertClause insert = queryFactory.insert(qPort);
for (Entry<Integer, Port> entry : addedPorts.entrySet()) {
populate(facilityId, entry.getKey(), entry.getValue(), insert);
insert.addBatch();
}
insert.execute();
}
}
示例10: insertUnavailableCapacity
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
private void insertUnavailableCapacity(long facilityId, List<UnavailableCapacity> unavailableCapacities) {
if (unavailableCapacities != null && !unavailableCapacities.isEmpty()) {
SQLInsertClause insert = queryFactory.insert(qUnavailableCapacity);
for (UnavailableCapacity unavailableCapacity : unavailableCapacities) {
insert.set(qUnavailableCapacity.facilityId, facilityId)
.set(qUnavailableCapacity.capacityType, unavailableCapacity.capacityType)
.set(qUnavailableCapacity.usage, unavailableCapacity.usage)
.set(qUnavailableCapacity.capacity, unavailableCapacity.capacity);
insert.addBatch();
}
insert.execute();
}
}
示例11: insertAliases
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
private void insertAliases(long facilityId, Collection<String> aliases) {
if (aliases != null && !aliases.isEmpty()) {
SQLInsertClause insertBatch = queryFactory.insert(qAlias);
for (String alias : aliases) {
insertBatch.set(qAlias.facilityId, facilityId);
insertBatch.set(qAlias.alias, alias);
insertBatch.addBatch();
}
insertBatch.execute();
}
}
示例12: updateServices
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
private void updateServices(long facilityId, Set<Service> services) {
queryFactory.delete(qService).where(qService.facilityId.eq(facilityId)).execute();
if (services != null && !services.isEmpty()) {
SQLInsertClause insert = queryFactory.insert(qService);
for (Service service : services) {
insert.set(qService.facilityId, facilityId).set(qService.service, service).addBatch();
}
insert.execute();
}
}
示例13: updatePaymentMethods
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
private void updatePaymentMethods(long facilityId, Set<PaymentMethod> paymentMethods) {
queryFactory.delete(qPaymentMethod).where(qPaymentMethod.facilityId.eq(facilityId)).execute();
if (paymentMethods != null && !paymentMethods.isEmpty()) {
SQLInsertClause insert = queryFactory.insert(qPaymentMethod);
for (PaymentMethod paymentMethod : paymentMethods) {
insert.set(qPaymentMethod.facilityId, facilityId).set(qPaymentMethod.paymentMethod, paymentMethod).addBatch();
}
insert.execute();
}
}
示例14: insertContact
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
@TransactionalWrite
public long insertContact(Contact contact, Long contactId) {
SQLInsertClause insert = queryFactory.insert(qContact);
insert.set(qContact.id, contactId);
populate(contact, insert);
insert.execute();
return contactId;
}
示例15: insertUser
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
@TransactionalWrite
public long insertUser(UserSecret userSecret, long userId) {
SQLInsertClause insert = queryFactory.insert(qUser);
insert.set(qUser.id, userId)
.set(qUser.password, userSecret.password)
.set(qUser.passwordUpdatedTimestamp, currentTime)
.set(qUser.minTokenTimestamp, currentTime)
.set(qUser.username, userSecret.user.username.toLowerCase())
.set(qUser.role, userSecret.user.role)
.set(qUser.operatorId, userSecret.user.operatorId);
insert.execute();
return userId;
}