use of org.seasar.doma.jdbc.SelectOptions in project doma by domaframework.
the class StandardDialectTest method testTransformSelectSqlNode_forUpdateWait.
@Test
public void testTransformSelectSqlNode_forUpdateWait() {
StandardDialect dialect = new StandardDialect();
SqlParser parser = new SqlParser("select * from emp order by emp.id");
SqlNode sqlNode = parser.parse();
SelectOptions options = SelectOptions.get().forUpdateWait(1);
try {
dialect.transformSelectSqlNode(sqlNode, options);
fail();
} catch (JdbcException ex) {
System.out.println(ex.getMessage());
assertEquals("DOMA2079", ex.getMessageResource().getCode());
}
}
use of org.seasar.doma.jdbc.SelectOptions in project doma by domaframework.
the class StandardDialectTest method testTransformSelectSqlNode_forUpdateNowait.
@Test
public void testTransformSelectSqlNode_forUpdateNowait() {
StandardDialect dialect = new StandardDialect();
SqlParser parser = new SqlParser("select * from emp order by emp.id");
SqlNode sqlNode = parser.parse();
SelectOptions options = SelectOptions.get().forUpdateNowait();
try {
dialect.transformSelectSqlNode(sqlNode, options);
fail();
} catch (JdbcException ex) {
System.out.println(ex.getMessage());
assertEquals("DOMA2080", ex.getMessageResource().getCode());
}
}
use of org.seasar.doma.jdbc.SelectOptions in project doma by domaframework.
the class SqlFileSelectCountTest method test.
@Test
public void test(Config config) throws Exception {
EmployeeDao dao = new EmployeeDaoImpl(config);
SelectOptions options = SelectOptions.get().count();
List<Employee> employees = dao.selectAll(options);
assertEquals(14, employees.size());
assertEquals(14, options.getCount());
}
use of org.seasar.doma.jdbc.SelectOptions in project doma by domaframework.
the class SqlFileSelectCountTest method testCountUnspecified.
@Test
public void testCountUnspecified(Config config) throws Exception {
EmployeeDao dao = new EmployeeDaoImpl(config);
SelectOptions options = SelectOptions.get();
List<Employee> employees = dao.selectAll(options);
assertEquals(14, employees.size());
assertEquals(-1, options.getCount());
}
use of org.seasar.doma.jdbc.SelectOptions in project stackoverflow-qa by yukihane.
the class SelectTest method testCount.
public void testCount() throws Exception {
LocalTransaction tx = AppConfig.getLocalTransaction();
try {
tx.begin();
SelectOptions options = SelectOptions.get().offset(5).limit(3).count();
List<Employee> list = dao.selectAll(options);
assertEquals(3, list.size());
assertEquals(14, options.getCount());
tx.commit();
} finally {
tx.rollback();
}
}
Aggregations