Search in sources :

Example 1 with Employee

use of org.seasar.doma.it.entity.Employee in project doma by domaframework.

the class AutoFunctionTest method testResultSet.

@Test
@Run(unless = { Dbms.MYSQL, Dbms.SQLSERVER })
public void testResultSet(Config config) throws Exception {
    FunctionDao dao = new FunctionDaoImpl(config);
    List<Employee> result = dao.func_resultset(Integer.valueOf(1));
    assertEquals(13, result.size());
}
Also used : Employee(org.seasar.doma.it.entity.Employee) FunctionDaoImpl(org.seasar.doma.it.dao.FunctionDaoImpl) FunctionDao(org.seasar.doma.it.dao.FunctionDao) Test(org.junit.jupiter.api.Test) Run(org.seasar.doma.it.Run)

Example 2 with Employee

use of org.seasar.doma.it.entity.Employee in project doma by domaframework.

the class AutoFunctionTest method testResultSet_nocheck.

@Test
@Run(unless = { Dbms.MYSQL, Dbms.SQLSERVER })
public void testResultSet_nocheck(Config config) throws Exception {
    FunctionDao dao = new FunctionDaoImpl(config);
    List<Employee> result = dao.func_resultset_nocheck(Integer.valueOf(1));
    assertEquals(13, result.size());
}
Also used : Employee(org.seasar.doma.it.entity.Employee) FunctionDaoImpl(org.seasar.doma.it.dao.FunctionDaoImpl) FunctionDao(org.seasar.doma.it.dao.FunctionDao) Test(org.junit.jupiter.api.Test) Run(org.seasar.doma.it.Run)

Example 3 with Employee

use of org.seasar.doma.it.entity.Employee in project doma by domaframework.

the class AutoFunctionTest method testResultSetAndUpdate.

@Test
@Run(unless = { Dbms.MYSQL, Dbms.SQLSERVER })
public void testResultSetAndUpdate(Config config) throws Exception {
    FunctionDao dao = new FunctionDaoImpl(config);
    List<Employee> result = dao.func_resultset_update(Integer.valueOf(1));
    assertEquals(13, result.size());
    DepartmentDao departmentDao = new DepartmentDaoImpl(config);
    Department department = departmentDao.selectById(Integer.valueOf(1));
    assertEquals("HOGE", department.getDepartmentName());
}
Also used : DepartmentDaoImpl(org.seasar.doma.it.dao.DepartmentDaoImpl) Department(org.seasar.doma.it.entity.Department) Employee(org.seasar.doma.it.entity.Employee) FunctionDaoImpl(org.seasar.doma.it.dao.FunctionDaoImpl) DepartmentDao(org.seasar.doma.it.dao.DepartmentDao) FunctionDao(org.seasar.doma.it.dao.FunctionDao) Test(org.junit.jupiter.api.Test) Run(org.seasar.doma.it.Run)

Example 4 with Employee

use of org.seasar.doma.it.entity.Employee 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);
}
Also used : EmployeeDao(org.seasar.doma.it.dao.EmployeeDao) CompKeyEmployeeDao(org.seasar.doma.it.dao.CompKeyEmployeeDao) CompKeyEmployee(org.seasar.doma.it.entity.CompKeyEmployee) Employee(org.seasar.doma.it.entity.Employee) EmployeeDaoImpl(org.seasar.doma.it.dao.EmployeeDaoImpl) CompKeyEmployeeDaoImpl(org.seasar.doma.it.dao.CompKeyEmployeeDaoImpl) Test(org.junit.jupiter.api.Test)

Example 5 with Employee

use of org.seasar.doma.it.entity.Employee 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) {
    }
}
Also used : EmployeeDao(org.seasar.doma.it.dao.EmployeeDao) CompKeyEmployeeDao(org.seasar.doma.it.dao.CompKeyEmployeeDao) CompKeyEmployee(org.seasar.doma.it.entity.CompKeyEmployee) Employee(org.seasar.doma.it.entity.Employee) OptimisticLockException(org.seasar.doma.jdbc.OptimisticLockException) EmployeeDaoImpl(org.seasar.doma.it.dao.EmployeeDaoImpl) CompKeyEmployeeDaoImpl(org.seasar.doma.it.dao.CompKeyEmployeeDaoImpl) Test(org.junit.jupiter.api.Test)

Aggregations

Employee (org.seasar.doma.it.entity.Employee)63 Test (org.junit.jupiter.api.Test)61 EmployeeDao (org.seasar.doma.it.dao.EmployeeDao)40 EmployeeDaoImpl (org.seasar.doma.it.dao.EmployeeDaoImpl)40 Run (org.seasar.doma.it.Run)11 ArrayList (java.util.ArrayList)8 CompKeyEmployeeDao (org.seasar.doma.it.dao.CompKeyEmployeeDao)8 CompKeyEmployeeDaoImpl (org.seasar.doma.it.dao.CompKeyEmployeeDaoImpl)8 ProcedureDao (org.seasar.doma.it.dao.ProcedureDao)8 ProcedureDaoImpl (org.seasar.doma.it.dao.ProcedureDaoImpl)8 CompKeyEmployee (org.seasar.doma.it.entity.CompKeyEmployee)8 SelectBuilder (org.seasar.doma.jdbc.builder.SelectBuilder)7 Department (org.seasar.doma.it.entity.Department)6 SelectOptions (org.seasar.doma.jdbc.SelectOptions)5 DepartmentDao (org.seasar.doma.it.dao.DepartmentDao)4 DepartmentDaoImpl (org.seasar.doma.it.dao.DepartmentDaoImpl)4 FunctionDao (org.seasar.doma.it.dao.FunctionDao)4 FunctionDaoImpl (org.seasar.doma.it.dao.FunctionDaoImpl)4 Config (org.seasar.doma.jdbc.Config)3 BigDecimal (java.math.BigDecimal)2