Search in sources :

Example 1 with CompKeyEmployeeDaoImpl

use of org.seasar.doma.it.dao.CompKeyEmployeeDaoImpl in project doma by domaframework.

the class AutoDeleteTest method testCompositeKey.

@Test
public void testCompositeKey(Config config) throws Exception {
    CompKeyEmployeeDao dao = new CompKeyEmployeeDaoImpl(config);
    CompKeyEmployee employee = new CompKeyEmployee();
    employee.setEmployeeId1(1);
    employee.setEmployeeId2(1);
    employee.setVersion(1);
    int result = dao.delete(employee);
    assertEquals(1, result);
    employee = dao.selectById(Integer.valueOf(1), Integer.valueOf(1));
    assertNull(employee);
}
Also used : CompKeyEmployeeDao(org.seasar.doma.it.dao.CompKeyEmployeeDao) CompKeyEmployeeDaoImpl(org.seasar.doma.it.dao.CompKeyEmployeeDaoImpl) CompKeyEmployee(org.seasar.doma.it.entity.CompKeyEmployee) Test(org.junit.jupiter.api.Test)

Example 2 with CompKeyEmployeeDaoImpl

use of org.seasar.doma.it.dao.CompKeyEmployeeDaoImpl in project doma by domaframework.

the class AutoBatchDeleteTest method testCompositeKey.

@Test
public void testCompositeKey(Config config) throws Exception {
    CompKeyEmployeeDao dao = new CompKeyEmployeeDaoImpl(config);
    CompKeyEmployee employee = new CompKeyEmployee();
    employee.setEmployeeId1(1);
    employee.setEmployeeId2(1);
    employee.setVersion(1);
    CompKeyEmployee employee2 = new CompKeyEmployee();
    employee2.setEmployeeId1(2);
    employee2.setEmployeeId2(2);
    employee2.setVersion(1);
    int[] result = dao.delete(Arrays.asList(employee, employee2));
    assertEquals(2, result.length);
    assertEquals(1, result[0]);
    assertEquals(1, result[1]);
    employee = dao.selectById(1, 1);
    assertNull(employee);
    employee = dao.selectById(2, 2);
    assertNull(employee);
}
Also used : CompKeyEmployeeDao(org.seasar.doma.it.dao.CompKeyEmployeeDao) CompKeyEmployeeDaoImpl(org.seasar.doma.it.dao.CompKeyEmployeeDaoImpl) CompKeyEmployee(org.seasar.doma.it.entity.CompKeyEmployee) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)2 CompKeyEmployeeDao (org.seasar.doma.it.dao.CompKeyEmployeeDao)2 CompKeyEmployeeDaoImpl (org.seasar.doma.it.dao.CompKeyEmployeeDaoImpl)2 CompKeyEmployee (org.seasar.doma.it.entity.CompKeyEmployee)2