use of org.seasar.doma.it.dao.DepartmentDaoImpl in project doma by domaframework.
the class AutoProcedureTest method testResultSetAndUpdate2.
@Test
public void testResultSetAndUpdate2(Config config) throws Exception {
ProcedureDao dao = new ProcedureDaoImpl(config);
List<Employee> employees = new ArrayList<>();
dao.proc_resultset_update2(employees, 1);
assertEquals(13, employees.size());
DepartmentDao departmentDao = new DepartmentDaoImpl(config);
Department department = departmentDao.selectById(1);
assertEquals("HOGE", department.getDepartmentName());
}
use of org.seasar.doma.it.dao.DepartmentDaoImpl in project doma by domaframework.
the class AutoUpdateTest method test.
@Test
public void test(Config config) throws Exception {
DepartmentDao dao = new DepartmentDaoImpl(config);
Department department = dao.selectById(1);
department.setDepartmentNo(1);
department.setDepartmentName("hoge");
int result = dao.update(department);
assertEquals(1, result);
assertEquals(Integer.valueOf(2), department.getVersion());
department = dao.selectById(1);
assertEquals(Integer.valueOf(1), department.getDepartmentId().getValue());
assertEquals(Integer.valueOf(1), department.getDepartmentNo());
assertEquals("hoge", department.getDepartmentName());
assertEquals("NEW YORK", department.getLocation().getValue());
assertEquals(Integer.valueOf(2), department.getVersion());
}
use of org.seasar.doma.it.dao.DepartmentDaoImpl in project doma by domaframework.
the class AutoUpdateTest method testSuppressOptimisticLockException.
@Test
public void testSuppressOptimisticLockException(Config config) throws Exception {
DepartmentDao dao = new DepartmentDaoImpl(config);
Department department1 = dao.selectById(1);
department1.setDepartmentName("hoge");
Department department2 = dao.selectById(1);
department2.setDepartmentName("foo");
dao.update(department1);
int rows = dao.update_suppressOptimisticLockException(department2);
assertEquals(0, rows);
}
use of org.seasar.doma.it.dao.DepartmentDaoImpl in project doma by domaframework.
the class AutoUpdateTest method testOptimisticLockException.
@Test
public void testOptimisticLockException(Config config) throws Exception {
DepartmentDao dao = new DepartmentDaoImpl(config);
Department department1 = dao.selectById(1);
department1.setDepartmentName("hoge");
Department department2 = dao.selectById(1);
department2.setDepartmentName("foo");
dao.update(department1);
try {
dao.update(department2);
fail();
} catch (OptimisticLockException expected) {
}
}
use of org.seasar.doma.it.dao.DepartmentDaoImpl in project doma by domaframework.
the class AutoUpdateTest method testExcludeNull.
@Test
public void testExcludeNull(Config config) throws Exception {
DepartmentDao dao = new DepartmentDaoImpl(config);
Department department = dao.selectById(1);
department.setDepartmentNo(1);
department.setDepartmentName(null);
int result = dao.update_excludeNull(department);
assertEquals(1, result);
department = dao.selectById(1);
assertEquals(Integer.valueOf(1), department.getDepartmentId().getValue());
assertEquals(Integer.valueOf(1), department.getDepartmentNo());
assertEquals("ACCOUNTING", department.getDepartmentName());
assertEquals("NEW YORK", department.getLocation().getValue());
assertEquals(Integer.valueOf(2), department.getVersion());
}
Aggregations