本文整理汇总了Java中com.mysema.query.sql.SQLQuery.uniqueResult方法的典型用法代码示例。如果您正苦于以下问题:Java SQLQuery.uniqueResult方法的具体用法?Java SQLQuery.uniqueResult怎么用?Java SQLQuery.uniqueResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mysema.query.sql.SQLQuery
的用法示例。
在下文中一共展示了SQLQuery.uniqueResult方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSaveAndLoad
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Test
public void testSaveAndLoad() {
LocalDate orig = LocalDate.now();
SQLInsertClause insert = queryFactory.insert(vd);
insert.set(vd.dt, orig);
long count = insert.execute();
assertEquals(1L, count);
SQLQuery query = queryFactory.from(vd);
LocalDate result = query.uniqueResult(vd.dt);
assertEquals(orig, result);
assertEquals(
Integer.valueOf(1),
jdbcOperations.queryForObject("SELECT COUNT(*) FROM verify_datetime WHERE dt=?", Integer.class,
orig.toString("yyyy-MM-dd")));
}
示例2: testSaveAndLoad_plus1d
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Test
public void testSaveAndLoad_plus1d() {
LocalDate orig = LocalDate.now().plusDays(1);
SQLInsertClause insert = queryFactory.insert(vd);
insert.set(vd.dt, orig);
long count = insert.execute();
assertEquals(1L, count);
SQLQuery query = queryFactory.from(vd);
LocalDate result = query.uniqueResult(vd.dt);
assertEquals(orig, result);
assertEquals(
Integer.valueOf(1),
jdbcOperations.queryForObject("SELECT COUNT(*) FROM verify_datetime WHERE dt=?", Integer.class,
orig.toString("yyyy-MM-dd")));
}
示例3: testSaveAndLoad
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Test
public void testSaveAndLoad() {
LocalDateTime orig = LocalDateTime.now();
SQLInsertClause insert = queryFactory.insert(vd);
insert.set(vd.dtm, orig);
long count = insert.execute();
assertEquals(1L, count);
SQLQuery query = queryFactory.from(vd);
LocalDateTime result = query.uniqueResult(vd.dtm);
assertEquals(orig, result);
assertEquals(
Integer.valueOf(1),
jdbcOperations.queryForObject("SELECT COUNT(*) FROM verify_datetime WHERE dtm=?", Integer.class,
orig.toString("yyyy-MM-dd HH:mm:ss.SSS")));
}
示例4: testSaveAndLoad_plus1d
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Test
public void testSaveAndLoad_plus1d() {
LocalDateTime orig = LocalDateTime.now().plusDays(1);
SQLInsertClause insert = queryFactory.insert(vd);
insert.set(vd.dtm, orig);
long count = insert.execute();
assertEquals(1L, count);
SQLQuery query = queryFactory.from(vd);
LocalDateTime result = query.uniqueResult(vd.dtm);
assertEquals(orig, result);
assertEquals(
Integer.valueOf(1),
jdbcOperations.queryForObject("SELECT COUNT(*) FROM verify_datetime WHERE dtm=?", Integer.class,
orig.toString("yyyy-MM-dd HH:mm:ss.SSS")));
}
示例5: testSaveAndLoad
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Test
public void testSaveAndLoad() {
LocalTime orig = LocalTime.now();
SQLInsertClause insert = queryFactory.insert(vd);
insert.set(vd.tm, orig);
long count = insert.execute();
assertEquals(1L, count);
SQLQuery query = queryFactory.from(vd);
LocalTime result = query.uniqueResult(vd.tm);
assertEquals(orig, result);
assertEquals(
Integer.valueOf(1),
jdbcOperations.queryForObject("SELECT COUNT(*) FROM verify_datetime WHERE tm=?", Integer.class,
orig.toString("HH:mm:ss.SSS")));
}
示例6: testSaveAndLoad_plus1h
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Test
public void testSaveAndLoad_plus1h() {
LocalTime orig = LocalTime.now().plusHours(1);
SQLInsertClause insert = queryFactory.insert(vd);
insert.set(vd.tm, orig);
long count = insert.execute();
assertEquals(1L, count);
SQLQuery query = queryFactory.from(vd);
LocalTime result = query.uniqueResult(vd.tm);
assertEquals(orig, result);
assertEquals(
Integer.valueOf(1),
jdbcOperations.queryForObject("SELECT COUNT(*) FROM verify_datetime WHERE tm=?", Integer.class,
orig.toString("HH:mm:ss.SSS")));
}
示例7: testSaveAndLoad_null
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Test
public void testSaveAndLoad_null() {
SQLInsertClause insert = queryFactory.insert(vd);
long count = insert.execute();
assertEquals(1L, count);
SQLQuery query = queryFactory.from(vd);
LocalDate result = query.uniqueResult(vd.dt);
assertNull(result);
}
示例8: testSaveAndLoad_null
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Test
public void testSaveAndLoad_null() {
SQLInsertClause insert = queryFactory.insert(vd);
long count = insert.execute();
assertEquals(1L, count);
SQLQuery query = queryFactory.from(vd);
LocalDateTime result = query.uniqueResult(vd.dtm);
assertNull(result);
}
示例9: testSaveAndLoad_null
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Test
public void testSaveAndLoad_null() {
SQLInsertClause insert = queryFactory.insert(vd);
long count = insert.execute();
assertEquals(1L, count);
SQLQuery query = queryFactory.from(vd);
LocalTime result = query.uniqueResult(vd.tm);
assertNull(result);
}
示例10: testQueryFromDual
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Test
public void testQueryFromDual() {
SQLQuery query = queryFactory.query();
SQLSubQuery subquery = queryFactory.subQuery();
query.where(subquery.exists());
Object[] object = query.uniqueResult(Wildcard.all);
assertEquals(1, object.length);
assertEquals(Long.valueOf(1L), object[0]);
}
示例11: today
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Transactional
@Override
public LocalDate today() {
SQLQuery query = createSqlQuery(bm);
LocalDate ldt = query.uniqueResult(bm.bizdate);
if (ldt == null) {
return LocalDate.now();
}
return ldt;
}
示例12: now
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Transactional
@Override
public LocalDateTime now() {
DateTimeExpression<LocalDateTime> curDtm = currentTimestamp(LocalDateTime.class);
SQLQuery query = createSqlQuery(bm);
Tuple tuple = query.uniqueResult(curDtm, bm.offsetDay, bm.offsetHour, bm.offsetMinute, bm.offsetSecond);
if (tuple == null) {
return LocalDateTime.now();
}
return tuple.get(curDtm).plusDays(tuple.get(bm.offsetDay)).plusHours(tuple.get(bm.offsetHour))
.plusMinutes(tuple.get(bm.offsetMinute)).plusSeconds(tuple.get(bm.offsetSecond));
}
示例13: getTemplate
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Transactional
@Override
public MailData getTemplate(String templateName) {
SQLQuery querya = queryFactory.from(mt);
querya.where(mt.templateName.eq(templateName), mt.deletedFlg.eq(DeletedFlag.NOT_DELETED.code()));
Tuple templ = querya.uniqueResult(mt.id, mt.fromAddr, mt.replyToAddr, mt.subject, mt.body);
SQLQuery queryb = queryFactory.from(mtr);
queryb.where(mtr.templateId.eq(templ.get(mt.id)), mtr.deletedFlg.eq(DeletedFlag.NOT_DELETED.code()));
List<Tuple> templAddr = queryb.list(mtr.rcptType, mtr.rcptAddr);
List<String> toAddr = new ArrayList<>();
List<String> ccAddr = new ArrayList<>();
List<String> bccAddr = new ArrayList<>();
for (Tuple addr : templAddr) {
RcptType type = RcptType.valueOf(addr.get(mtr.rcptType));
if (type == RcptType.TO) {
toAddr.add(addr.get(mtr.rcptAddr));
}
if (type == RcptType.CC) {
ccAddr.add(addr.get(mtr.rcptAddr));
}
if (type == RcptType.BCC) {
bccAddr.add(addr.get(mtr.rcptAddr));
}
}
MailData template = new MailData();
template.setFromAddr(templ.get(mt.fromAddr));
template.setToAddr(toAddr);
template.setCcAddr(ccAddr);
template.setBccAddr(bccAddr);
template.setReplyToAddr(templ.get(mt.replyToAddr));
template.setSubject(templ.get(mt.subject));
template.setBody(templ.get(mt.body));
return template;
}
示例14: findByValue
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Transactional(readOnly = true)
@Override
public CodeEntry findByValue(String codeName, String value) {
SQLQuery query = queryFactory.from(qcm);
query.where(qcm.name.eq(codeName), qcm.value.eq(value), qcm.deletedFlg.eq(DeletedFlag.NOT_DELETED.code()));
return query.uniqueResult(new QBean<>(CodeEntry.class, qcm.value, qcm.label, qcm.sortOrder));
}
示例15: getNumberOfWorkday
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Transactional
@Override
public int getNumberOfWorkday(String name, LocalDate from, LocalDate to) {
SQLQuery query = queryFactory.from(h0);
query.where(h0.name.eq(name), h0.dt.between(constant(from), constant(to)), h0.deletedFlg.eq(NOT_DELETED.code()));
long count = query.uniqueResult(h0.dt.count());
return Days.daysBetween(from, to).getDays() + 1 - (int) count;
}