Search in sources :

Example 1 with SalesmanDao

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

the class AutoUpdateTest method testTenantId.

@Test
public void testTenantId(Config config) throws Exception {
    SalesmanDao dao = new SalesmanDaoImpl(config);
    Salesman salesman = dao.selectById(1);
    Integer tenantId = salesman.departmentId;
    salesman.departmentId = -1;
    try {
        dao.update(salesman);
        fail();
    } catch (OptimisticLockException expected) {
    }
    salesman.departmentId = tenantId;
    dao.update(salesman);
}
Also used : Salesman(org.seasar.doma.it.entity.Salesman) SalesmanDao(org.seasar.doma.it.dao.SalesmanDao) SalesmanDaoImpl(org.seasar.doma.it.dao.SalesmanDaoImpl) OptimisticLockException(org.seasar.doma.jdbc.OptimisticLockException) Test(org.junit.jupiter.api.Test)

Example 2 with SalesmanDao

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

the class AutoBatchDeleteTest method testTenantId.

@Test
public void testTenantId(Config config) throws Exception {
    SalesmanDao dao = new SalesmanDaoImpl(config);
    Salesman salesman = dao.selectById(1);
    Integer tenantId = salesman.departmentId;
    salesman.departmentId = -1;
    try {
        dao.delete(Arrays.asList(salesman));
        fail();
    } catch (OptimisticLockException expected) {
    }
    salesman.departmentId = tenantId;
    dao.delete(Arrays.asList(salesman));
}
Also used : Salesman(org.seasar.doma.it.entity.Salesman) SalesmanDao(org.seasar.doma.it.dao.SalesmanDao) SalesmanDaoImpl(org.seasar.doma.it.dao.SalesmanDaoImpl) OptimisticLockException(org.seasar.doma.jdbc.OptimisticLockException) Test(org.junit.jupiter.api.Test)

Example 3 with SalesmanDao

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

the class AutoBatchUpdateTest method testTenantId.

@Test
public void testTenantId(Config config) throws Exception {
    SalesmanDao dao = new SalesmanDaoImpl(config);
    Salesman salesman = dao.selectById(1);
    Integer tenantId = salesman.departmentId;
    salesman.departmentId = -1;
    try {
        dao.update(Arrays.asList(salesman));
        fail();
    } catch (OptimisticLockException expected) {
    }
    salesman.departmentId = tenantId;
    dao.update(Arrays.asList(salesman));
}
Also used : Salesman(org.seasar.doma.it.entity.Salesman) SalesmanDao(org.seasar.doma.it.dao.SalesmanDao) SalesmanDaoImpl(org.seasar.doma.it.dao.SalesmanDaoImpl) OptimisticLockException(org.seasar.doma.jdbc.OptimisticLockException) Test(org.junit.jupiter.api.Test)

Example 4 with SalesmanDao

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

the class AutoDeleteTest method testTenantId.

@Test
public void testTenantId(Config config) throws Exception {
    SalesmanDao dao = new SalesmanDaoImpl(config);
    Salesman salesman = dao.selectById(1);
    Integer tenantId = salesman.departmentId;
    salesman.departmentId = -1;
    try {
        dao.delete(salesman);
        fail();
    } catch (OptimisticLockException expected) {
    }
    salesman.departmentId = tenantId;
    dao.delete(salesman);
}
Also used : Salesman(org.seasar.doma.it.entity.Salesman) SalesmanDao(org.seasar.doma.it.dao.SalesmanDao) SalesmanDaoImpl(org.seasar.doma.it.dao.SalesmanDaoImpl) OptimisticLockException(org.seasar.doma.jdbc.OptimisticLockException) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)4 SalesmanDao (org.seasar.doma.it.dao.SalesmanDao)4 SalesmanDaoImpl (org.seasar.doma.it.dao.SalesmanDaoImpl)4 Salesman (org.seasar.doma.it.entity.Salesman)4 OptimisticLockException (org.seasar.doma.jdbc.OptimisticLockException)4