Search in sources :

Example 6 with PkfieldsKey

use of mbg.test.ib2j5.generated.conditional.model.PkfieldsKey in project generator by mybatis.

the class UpdateByPrimaryKeyTest method testPKFieldsUpdateByPrimaryKey.

public void testPKFieldsUpdateByPrimaryKey() {
    PkfieldsDAO dao = getPkfieldsDAO();
    try {
        Pkfields record = new Pkfields();
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setId1(new Integer(1));
        record.setId2(new Integer(2));
        dao.insert(record);
        record.setFirstname("Scott");
        record.setLastname("Jones");
        int rows = dao.updateByPrimaryKey(record);
        assertEquals(1, rows);
        PkfieldsKey key = new PkfieldsKey();
        key.setId1(new Integer(1));
        key.setId2(new Integer(2));
        Pkfields record2 = dao.selectByPrimaryKey(key);
        assertEquals(record.getFirstname(), record2.getFirstname());
        assertEquals(record.getLastname(), record2.getLastname());
        assertEquals(record.getId1(), record2.getId1());
        assertEquals(record.getId2(), record2.getId2());
    } catch (Exception e) {
        fail(e.getMessage());
    }
}
Also used : Pkfields(mbg.test.ib2j2.generated.conditional.model.Pkfields) PkfieldsKey(mbg.test.ib2j2.generated.conditional.model.PkfieldsKey) PkfieldsDAO(mbg.test.ib2j2.generated.conditional.dao.PkfieldsDAO)

Example 7 with PkfieldsKey

use of mbg.test.ib2j5.generated.conditional.model.PkfieldsKey in project generator by mybatis.

the class ConditionalJava5Test method testPKfieldsDeleteByPrimaryKey.

@Test
public void testPKfieldsDeleteByPrimaryKey() {
    SqlSession sqlSession = sqlSessionFactory.openSession();
    try {
        PkfieldsMapper mapper = sqlSession.getMapper(PkfieldsMapper.class);
        Pkfields record = new Pkfields();
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setId1(1);
        record.setId2(2);
        mapper.insert(record);
        PkfieldsKey key = new PkfieldsKey();
        key.setId1(1);
        key.setId2(2);
        int rows = mapper.deleteByPrimaryKey(key);
        assertEquals(1, rows);
        PkfieldsExample example = new PkfieldsExample();
        List<Pkfields> answer = mapper.selectByExample(example);
        assertEquals(0, answer.size());
    } finally {
        sqlSession.close();
    }
}
Also used : SqlSession(org.apache.ibatis.session.SqlSession) PkfieldsMapper(mbg.test.mb3.generated.conditional.mapper.PkfieldsMapper) Pkfields(mbg.test.mb3.generated.conditional.model.Pkfields) PkfieldsKey(mbg.test.mb3.generated.conditional.model.PkfieldsKey) PkfieldsExample(mbg.test.mb3.generated.conditional.model.PkfieldsExample) Test(org.junit.Test)

Example 8 with PkfieldsKey

use of mbg.test.ib2j5.generated.conditional.model.PkfieldsKey in project generator by mybatis.

the class ConditionalJava5Test method testPKFieldsUpdateByPrimaryKey.

@Test
public void testPKFieldsUpdateByPrimaryKey() {
    SqlSession sqlSession = sqlSessionFactory.openSession();
    try {
        PkfieldsMapper mapper = sqlSession.getMapper(PkfieldsMapper.class);
        Pkfields record = new Pkfields();
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setId1(1);
        record.setId2(2);
        mapper.insert(record);
        record.setFirstname("Scott");
        record.setLastname("Jones");
        int rows = mapper.updateByPrimaryKey(record);
        assertEquals(1, rows);
        PkfieldsKey key = new PkfieldsKey();
        key.setId1(1);
        key.setId2(2);
        Pkfields record2 = mapper.selectByPrimaryKey(key);
        assertEquals(record.getFirstname(), record2.getFirstname());
        assertEquals(record.getLastname(), record2.getLastname());
        assertEquals(record.getId1(), record2.getId1());
        assertEquals(record.getId2(), record2.getId2());
    } finally {
        sqlSession.close();
    }
}
Also used : SqlSession(org.apache.ibatis.session.SqlSession) PkfieldsMapper(mbg.test.mb3.generated.conditional.mapper.PkfieldsMapper) Pkfields(mbg.test.mb3.generated.conditional.model.Pkfields) PkfieldsKey(mbg.test.mb3.generated.conditional.model.PkfieldsKey) Test(org.junit.Test)

Example 9 with PkfieldsKey

use of mbg.test.ib2j5.generated.conditional.model.PkfieldsKey in project generator by mybatis.

the class SelectByPrimaryKeyTest method testPKFieldsSelectByPrimaryKey.

public void testPKFieldsSelectByPrimaryKey() {
    PkfieldsDAO dao = getPkfieldsDAO();
    try {
        Pkfields record = new Pkfields();
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setId1(new Integer(1));
        record.setId2(new Integer(2));
        dao.insert(record);
        record = new Pkfields();
        record.setFirstname("Bob");
        record.setLastname("Jones");
        record.setId1(new Integer(3));
        record.setId2(new Integer(4));
        dao.insert(record);
        PkfieldsKey key = new PkfieldsKey();
        key.setId1(new Integer(3));
        key.setId2(new Integer(4));
        Pkfields newRecord = dao.selectByPrimaryKey(key);
        assertNotNull(newRecord);
        assertEquals(record.getFirstname(), newRecord.getFirstname());
        assertEquals(record.getLastname(), newRecord.getLastname());
        assertEquals(record.getId1(), newRecord.getId1());
        assertEquals(record.getId2(), newRecord.getId2());
    } catch (Exception e) {
        fail(e.getMessage());
    }
}
Also used : Pkfields(mbg.test.ib2j2.generated.conditional.model.Pkfields) PkfieldsKey(mbg.test.ib2j2.generated.conditional.model.PkfieldsKey) PkfieldsDAO(mbg.test.ib2j2.generated.conditional.dao.PkfieldsDAO)

Example 10 with PkfieldsKey

use of mbg.test.ib2j5.generated.conditional.model.PkfieldsKey in project generator by mybatis.

the class ConditionalJava5Test method testPKFieldsSelectByPrimaryKey.

@Test
public void testPKFieldsSelectByPrimaryKey() {
    SqlSession sqlSession = sqlSessionFactory.openSession();
    try {
        PkfieldsMapper mapper = sqlSession.getMapper(PkfieldsMapper.class);
        Pkfields record = new Pkfields();
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setId1(1);
        record.setId2(2);
        mapper.insert(record);
        record = new Pkfields();
        record.setFirstname("Bob");
        record.setLastname("Jones");
        record.setId1(3);
        record.setId2(4);
        mapper.insert(record);
        PkfieldsKey key = new PkfieldsKey();
        key.setId1(3);
        key.setId2(4);
        Pkfields newRecord = mapper.selectByPrimaryKey(key);
        assertNotNull(newRecord);
        assertEquals(record.getFirstname(), newRecord.getFirstname());
        assertEquals(record.getLastname(), newRecord.getLastname());
        assertEquals(record.getId1(), newRecord.getId1());
        assertEquals(record.getId2(), newRecord.getId2());
    } finally {
        sqlSession.close();
    }
}
Also used : SqlSession(org.apache.ibatis.session.SqlSession) PkfieldsMapper(mbg.test.mb3.generated.conditional.mapper.PkfieldsMapper) Pkfields(mbg.test.mb3.generated.conditional.model.Pkfields) PkfieldsKey(mbg.test.mb3.generated.conditional.model.PkfieldsKey) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)15 PkfieldsDAO (mbg.test.ib2j2.generated.conditional.dao.PkfieldsDAO)5 Pkfields (mbg.test.ib2j2.generated.conditional.model.Pkfields)5 PkfieldsKey (mbg.test.ib2j2.generated.conditional.model.PkfieldsKey)5 PkfieldsDAO (mbg.test.ib2j5.generated.conditional.dao.PkfieldsDAO)5 Pkfields (mbg.test.ib2j5.generated.conditional.model.Pkfields)5 PkfieldsKey (mbg.test.ib2j5.generated.conditional.model.PkfieldsKey)5 PkfieldsDAO (mbg.test.ib2j5.generated.hierarchical.dao.PkfieldsDAO)5 Pkfields (mbg.test.ib2j5.generated.hierarchical.model.Pkfields)5 PkfieldsKey (mbg.test.ib2j5.generated.hierarchical.model.PkfieldsKey)5 PkfieldsMapper (mbg.test.mb3.generated.conditional.mapper.PkfieldsMapper)5 Pkfields (mbg.test.mb3.generated.conditional.model.Pkfields)5 PkfieldsKey (mbg.test.mb3.generated.conditional.model.PkfieldsKey)5 SqlSession (org.apache.ibatis.session.SqlSession)5 BigDecimal (java.math.BigDecimal)4 SQLException (java.sql.SQLException)4 Date (java.util.Date)4 List (java.util.List)1 PkfieldsExample (mbg.test.ib2j2.generated.conditional.model.PkfieldsExample)1 PkfieldsExample (mbg.test.ib2j5.generated.conditional.model.PkfieldsExample)1