Search in sources :

Example 6 with EmployeeDaoImpl

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

Example 7 with EmployeeDaoImpl

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

the class SqlFileSelectForUpdateTest method testForUpdateWithColumns.

@Test
@Run(unless = { Dbms.HSQLDB, Dbms.H2, Dbms.POSTGRESQL, Dbms.MYSQL, Dbms.DB2, Dbms.SQLSERVER, Dbms.SQLITE })
public void testForUpdateWithColumns(Config config) throws Exception {
    EmployeeDao dao = new EmployeeDaoImpl(config);
    Employee employee = dao.selectById(1, SelectOptions.get().forUpdate("employee_name", "address_id"));
    assertNotNull(employee);
}
Also used : EmployeeDao(org.seasar.doma.it.dao.EmployeeDao) Employee(org.seasar.doma.it.entity.Employee) EmployeeDaoImpl(org.seasar.doma.it.dao.EmployeeDaoImpl) Test(org.junit.jupiter.api.Test) Run(org.seasar.doma.it.Run)

Example 8 with EmployeeDaoImpl

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

the class SqlFileSelectForUpdateTest method testForUpdateNowait.

@Test
@Run(unless = { Dbms.HSQLDB, Dbms.H2, Dbms.POSTGRESQL, Dbms.MYSQL, Dbms.DB2, Dbms.SQLITE })
public void testForUpdateNowait(Config config) throws Exception {
    EmployeeDao dao = new EmployeeDaoImpl(config);
    Employee employee = dao.selectById(1, SelectOptions.get().forUpdateNowait());
    assertNotNull(employee);
}
Also used : EmployeeDao(org.seasar.doma.it.dao.EmployeeDao) Employee(org.seasar.doma.it.entity.Employee) EmployeeDaoImpl(org.seasar.doma.it.dao.EmployeeDaoImpl) Test(org.junit.jupiter.api.Test) Run(org.seasar.doma.it.Run)

Example 9 with EmployeeDaoImpl

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

the class SqlFileSelectForUpdateTest method testForUpdateWait.

@Test
@Run(unless = { Dbms.HSQLDB, Dbms.H2, Dbms.POSTGRESQL, Dbms.MYSQL, Dbms.DB2, Dbms.SQLSERVER, Dbms.SQLITE })
public void testForUpdateWait(Config config) throws Exception {
    EmployeeDao dao = new EmployeeDaoImpl(config);
    Employee employee = dao.selectById(1, SelectOptions.get().forUpdateWait(10));
    assertNotNull(employee);
}
Also used : EmployeeDao(org.seasar.doma.it.dao.EmployeeDao) Employee(org.seasar.doma.it.entity.Employee) EmployeeDaoImpl(org.seasar.doma.it.dao.EmployeeDaoImpl) Test(org.junit.jupiter.api.Test) Run(org.seasar.doma.it.Run)

Example 10 with EmployeeDaoImpl

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

the class SqlFileSelectForUpdateTest method testUnsupported.

@Test
@Run(unless = { Dbms.H2, Dbms.POSTGRESQL, Dbms.ORACLE, Dbms.MYSQL, Dbms.DB2, Dbms.SQLSERVER })
public void testUnsupported(Config config) throws Exception {
    EmployeeDao dao = new EmployeeDaoImpl(config);
    try {
        dao.selectById(1, SelectOptions.get().forUpdate());
        fail();
    } catch (JdbcException expected) {
        assertEquals(Message.DOMA2023, expected.getMessageResource());
    }
}
Also used : EmployeeDao(org.seasar.doma.it.dao.EmployeeDao) JdbcException(org.seasar.doma.jdbc.JdbcException) EmployeeDaoImpl(org.seasar.doma.it.dao.EmployeeDaoImpl) Test(org.junit.jupiter.api.Test) Run(org.seasar.doma.it.Run)

Aggregations

Test (org.junit.jupiter.api.Test)54 EmployeeDao (org.seasar.doma.it.dao.EmployeeDao)54 EmployeeDaoImpl (org.seasar.doma.it.dao.EmployeeDaoImpl)54 Employee (org.seasar.doma.it.entity.Employee)43 Run (org.seasar.doma.it.Run)8 CompKeyEmployeeDao (org.seasar.doma.it.dao.CompKeyEmployeeDao)8 CompKeyEmployeeDaoImpl (org.seasar.doma.it.dao.CompKeyEmployeeDaoImpl)8 CompKeyEmployee (org.seasar.doma.it.entity.CompKeyEmployee)8 SelectOptions (org.seasar.doma.jdbc.SelectOptions)8 BigDecimal (java.math.BigDecimal)6 Objects (java.util.Objects)4 Stream (java.util.stream.Stream)4 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)4 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)4 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)4 IntegrationTestEnvironment (org.seasar.doma.it.IntegrationTestEnvironment)4 Config (org.seasar.doma.jdbc.Config)4 HiredateImpl (org.seasar.doma.it.domain.HiredateImpl)2 OptimisticLockException (org.seasar.doma.jdbc.OptimisticLockException)2 List (java.util.List)1