Search in sources :

Example 1 with NoId

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

the class AutoInsertTest method testNoId.

@Test
public void testNoId(Config config) throws Exception {
    NoIdDao dao = new NoIdDaoImpl(config);
    NoId entity = new NoId();
    entity.setValue1(1);
    entity.setValue2(2);
    int result = dao.insert(entity);
    assertEquals(1, result);
}
Also used : NoIdDao(org.seasar.doma.it.dao.NoIdDao) NoId(org.seasar.doma.it.entity.NoId) NoIdDaoImpl(org.seasar.doma.it.dao.NoIdDaoImpl) Test(org.junit.jupiter.api.Test)

Example 2 with NoId

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

the class AutoBatchUpdateTest method testNoId.

@Test
public void testNoId(Config config) throws Exception {
    NoIdDao dao = new NoIdDaoImpl(config);
    NoId entity = new NoId();
    entity.setValue1(1);
    entity.setValue2(2);
    NoId entity2 = new NoId();
    entity2.setValue1(1);
    entity2.setValue2(2);
    try {
        dao.update(Arrays.asList(entity, entity2));
        fail();
    } catch (JdbcException expected) {
        assertEquals(Message.DOMA2022, expected.getMessageResource());
    }
}
Also used : NoIdDao(org.seasar.doma.it.dao.NoIdDao) NoId(org.seasar.doma.it.entity.NoId) NoIdDaoImpl(org.seasar.doma.it.dao.NoIdDaoImpl) JdbcException(org.seasar.doma.jdbc.JdbcException) Test(org.junit.jupiter.api.Test)

Example 3 with NoId

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

the class AutoDeleteTest method testNoId.

@Test
public void testNoId(Config config) throws Exception {
    NoIdDao dao = new NoIdDaoImpl(config);
    NoId entity = new NoId();
    entity.setValue1(1);
    entity.setValue2(2);
    try {
        dao.delete(entity);
        fail();
    } catch (JdbcException expected) {
        assertEquals(Message.DOMA2022, expected.getMessageResource());
    }
}
Also used : NoIdDao(org.seasar.doma.it.dao.NoIdDao) NoId(org.seasar.doma.it.entity.NoId) NoIdDaoImpl(org.seasar.doma.it.dao.NoIdDaoImpl) JdbcException(org.seasar.doma.jdbc.JdbcException) Test(org.junit.jupiter.api.Test)

Example 4 with NoId

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

the class AutoUpdateTest method testNoId.

@Test
public void testNoId(Config config) throws Exception {
    NoIdDao dao = new NoIdDaoImpl(config);
    NoId entity = new NoId();
    entity.setValue1(1);
    entity.setValue2(2);
    try {
        dao.update(entity);
        fail();
    } catch (JdbcException expected) {
        assertEquals(Message.DOMA2022, expected.getMessageResource());
    }
}
Also used : NoIdDao(org.seasar.doma.it.dao.NoIdDao) NoId(org.seasar.doma.it.entity.NoId) NoIdDaoImpl(org.seasar.doma.it.dao.NoIdDaoImpl) JdbcException(org.seasar.doma.jdbc.JdbcException) Test(org.junit.jupiter.api.Test)

Example 5 with NoId

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

the class AutoBatchInsertTest method testNoId.

@Test
public void testNoId(Config config) throws Exception {
    NoIdDao dao = new NoIdDaoImpl(config);
    NoId entity = new NoId();
    entity.setValue1(1);
    entity.setValue2(2);
    NoId entity2 = new NoId();
    entity2.setValue1(1);
    entity2.setValue2(2);
    int[] result = dao.insert(Arrays.asList(entity, entity2));
    assertEquals(2, result.length);
    assertEquals(1, result[0]);
    assertEquals(1, result[1]);
}
Also used : NoIdDao(org.seasar.doma.it.dao.NoIdDao) NoId(org.seasar.doma.it.entity.NoId) NoIdDaoImpl(org.seasar.doma.it.dao.NoIdDaoImpl) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)6 NoIdDao (org.seasar.doma.it.dao.NoIdDao)6 NoIdDaoImpl (org.seasar.doma.it.dao.NoIdDaoImpl)6 NoId (org.seasar.doma.it.entity.NoId)6 JdbcException (org.seasar.doma.jdbc.JdbcException)4