use of org.seasar.doma.it.dao.EmployeeDaoImpl in project doma by domaframework.
the class AutoDeleteTest method testIgnoreVersion.
@Test
public void testIgnoreVersion(Config config) throws Exception {
EmployeeDao dao = new EmployeeDaoImpl(config);
Employee employee = new Employee();
employee.setEmployeeId(1);
employee.setVersion(99);
int result = dao.delete_ignoreVersion(employee);
assertEquals(1, result);
employee = dao.selectById(Integer.valueOf(1));
assertNull(employee);
}
use of org.seasar.doma.it.dao.EmployeeDaoImpl in project doma by domaframework.
the class AutoDeleteTest method testOptimisticLockException.
@Test
public void testOptimisticLockException(Config config) throws Exception {
EmployeeDao dao = new EmployeeDaoImpl(config);
Employee employee1 = dao.selectById(Integer.valueOf(1));
employee1.setEmployeeName("hoge");
Employee employee2 = dao.selectById(Integer.valueOf(1));
employee2.setEmployeeName("foo");
dao.delete(employee1);
try {
dao.delete(employee2);
fail();
} catch (OptimisticLockException expected) {
}
}
use of org.seasar.doma.it.dao.EmployeeDaoImpl in project doma by domaframework.
the class PrimitiveTypeTest method map_null_to_reference_type.
@Test
void map_null_to_reference_type(Config config) {
EmployeeDao dao = new EmployeeDaoImpl(config);
Employee e = dao.selectById(9);
Integer managerId = e.getManagerId();
assertNull(managerId);
}
use of org.seasar.doma.it.dao.EmployeeDaoImpl in project doma by domaframework.
the class SqlFileSelectCollectorTest method testCollectAll2.
@Test
public void testCollectAll2(Config config) throws Exception {
EmployeeDao dao = new EmployeeDaoImpl(config);
Map<Identity<Department>, List<Employee>> group = dao.collectAll(Collectors.groupingBy(Employee::getDepartmentId));
System.out.println(group);
}
use of org.seasar.doma.it.dao.EmployeeDaoImpl 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());
}
Aggregations