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


Java SQLQuery.uniqueResult方法代码示例

本文整理汇总了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")));
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:19,代码来源:LocalDateTypeTest.java

示例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")));
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:19,代码来源:LocalDateTypeTest.java

示例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")));
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:19,代码来源:LocalDateTimeTypeTest.java

示例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")));
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:19,代码来源:LocalDateTimeTypeTest.java

示例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")));
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:19,代码来源:LocalTimeTypeTest.java

示例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")));
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:19,代码来源:LocalTimeTypeTest.java

示例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);
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:12,代码来源:LocalDateTypeTest.java

示例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);
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:12,代码来源:LocalDateTimeTypeTest.java

示例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);
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:12,代码来源:LocalTimeTypeTest.java

示例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]);
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:10,代码来源:SQLQueryFactoryTest.java

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

示例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));
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:13,代码来源:BizDateTimeImpl.java

示例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;
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:39,代码来源:TemplateStoreImpl.java

示例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));
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:8,代码来源:CodeStoreImpl.java

示例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;
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:9,代码来源:WorkdayStoreImpl.java


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