Search in sources :

Example 6 with PkfieldsblobsKey

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

the class ConditionalJava5Test method testPKFieldsBlobsUpdateByPrimaryKeyWithBLOBs.

@Test
public void testPKFieldsBlobsUpdateByPrimaryKeyWithBLOBs() {
    SqlSession sqlSession = sqlSessionFactory.openSession();
    try {
        PkfieldsblobsMapper mapper = sqlSession.getMapper(PkfieldsblobsMapper.class);
        Pkfieldsblobs record = new Pkfieldsblobs();
        record.setId1(3);
        record.setId2(4);
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setBlob1(generateRandomBlob());
        mapper.insert(record);
        Pkfieldsblobs updateRecord = new Pkfieldsblobs();
        updateRecord.setId1(3);
        updateRecord.setId2(4);
        updateRecord.setFirstname("Scott");
        updateRecord.setLastname("Jones");
        updateRecord.setBlob1(generateRandomBlob());
        int rows = mapper.updateByPrimaryKeyWithBLOBs(updateRecord);
        assertEquals(1, rows);
        PkfieldsblobsKey key = new PkfieldsblobsKey();
        key.setId1(3);
        key.setId2(4);
        Pkfieldsblobs newRecord = mapper.selectByPrimaryKey(key);
        assertEquals(updateRecord.getFirstname(), newRecord.getFirstname());
        assertEquals(updateRecord.getLastname(), newRecord.getLastname());
        assertEquals(record.getId1(), newRecord.getId1());
        assertEquals(record.getId2(), newRecord.getId2());
        assertTrue(blobsAreEqual(updateRecord.getBlob1(), newRecord.getBlob1()));
    } finally {
        sqlSession.close();
    }
}
Also used : Pkfieldsblobs(mbg.test.mb3.generated.conditional.model.Pkfieldsblobs) PkfieldsblobsKey(mbg.test.mb3.generated.conditional.model.PkfieldsblobsKey) SqlSession(org.apache.ibatis.session.SqlSession) PkfieldsblobsMapper(mbg.test.mb3.generated.conditional.mapper.PkfieldsblobsMapper) Test(org.junit.Test)

Example 7 with PkfieldsblobsKey

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

the class ConditionalJava5Test method testPKFieldsBlobsSelectByPrimaryKey.

@Test
public void testPKFieldsBlobsSelectByPrimaryKey() {
    SqlSession sqlSession = sqlSessionFactory.openSession();
    try {
        PkfieldsblobsMapper mapper = sqlSession.getMapper(PkfieldsblobsMapper.class);
        Pkfieldsblobs record = new Pkfieldsblobs();
        record.setId1(3);
        record.setId2(4);
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setBlob1(generateRandomBlob());
        mapper.insert(record);
        record = new Pkfieldsblobs();
        record.setId1(5);
        record.setId2(6);
        record.setFirstname("Scott");
        record.setLastname("Jones");
        record.setBlob1(generateRandomBlob());
        mapper.insert(record);
        PkfieldsblobsExample example = new PkfieldsblobsExample();
        List<Pkfieldsblobs> answer = mapper.selectByExample(example);
        assertEquals(2, answer.size());
        PkfieldsblobsKey key = new PkfieldsblobsKey();
        key.setId1(5);
        key.setId2(6);
        Pkfieldsblobs newRecord = mapper.selectByPrimaryKey(key);
        assertEquals(record.getId1(), newRecord.getId1());
        assertEquals(record.getId2(), newRecord.getId2());
        assertEquals(record.getFirstname(), newRecord.getFirstname());
        assertEquals(record.getLastname(), newRecord.getLastname());
        assertTrue(blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
    } finally {
        sqlSession.close();
    }
}
Also used : Pkfieldsblobs(mbg.test.mb3.generated.conditional.model.Pkfieldsblobs) PkfieldsblobsKey(mbg.test.mb3.generated.conditional.model.PkfieldsblobsKey) SqlSession(org.apache.ibatis.session.SqlSession) PkfieldsblobsExample(mbg.test.mb3.generated.conditional.model.PkfieldsblobsExample) PkfieldsblobsMapper(mbg.test.mb3.generated.conditional.mapper.PkfieldsblobsMapper) Test(org.junit.Test)

Example 8 with PkfieldsblobsKey

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

the class SelectByPrimaryKeyTest method testPKFieldsBlobsSelectByPrimaryKey.

public void testPKFieldsBlobsSelectByPrimaryKey() {
    PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
    try {
        Pkfieldsblobs record = new Pkfieldsblobs();
        record.setId1(new Integer(3));
        record.setId2(new Integer(4));
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setBlob1(TestUtilities.generateRandomBlob());
        dao.insert(record);
        record = new Pkfieldsblobs();
        record.setId1(new Integer(5));
        record.setId2(new Integer(6));
        record.setFirstname("Scott");
        record.setLastname("Jones");
        record.setBlob1(TestUtilities.generateRandomBlob());
        dao.insert(record);
        PkfieldsblobsExample example = new PkfieldsblobsExample();
        List answer = dao.selectByExampleWithoutBLOBs(example);
        assertEquals(2, answer.size());
        PkfieldsblobsKey key = new PkfieldsblobsKey();
        key.setId1(new Integer(5));
        key.setId2(new Integer(6));
        Pkfieldsblobs newRecord = dao.selectByPrimaryKey(key);
        assertEquals(record.getId1(), newRecord.getId1());
        assertEquals(record.getId2(), newRecord.getId2());
        assertEquals(record.getFirstname(), newRecord.getFirstname());
        assertEquals(record.getLastname(), newRecord.getLastname());
        assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
    } catch (Exception e) {
        fail(e.getMessage());
    }
}
Also used : Pkfieldsblobs(mbg.test.ib2j2.generated.conditional.model.Pkfieldsblobs) PkfieldsblobsKey(mbg.test.ib2j2.generated.conditional.model.PkfieldsblobsKey) PkfieldsblobsExample(mbg.test.ib2j2.generated.conditional.model.PkfieldsblobsExample) List(java.util.List) PkfieldsblobsDAO(mbg.test.ib2j2.generated.conditional.dao.PkfieldsblobsDAO)

Example 9 with PkfieldsblobsKey

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

the class HierarchicalJava5Test method testPKFieldsBlobsDeleteByPrimaryKey.

@Test
public void testPKFieldsBlobsDeleteByPrimaryKey() {
    PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
    try {
        PkfieldsblobsWithBLOBs record = new PkfieldsblobsWithBLOBs();
        record.setId1(3);
        record.setId2(4);
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setBlob1(generateRandomBlob());
        dao.insert(record);
        record = new PkfieldsblobsWithBLOBs();
        record.setId1(5);
        record.setId2(6);
        record.setFirstname("Scott");
        record.setLastname("Jones");
        record.setBlob1(generateRandomBlob());
        dao.insert(record);
        PkfieldsblobsExample example = new PkfieldsblobsExample();
        List<Pkfieldsblobs> answer = dao.selectByExampleWithoutBLOBs(example);
        assertEquals(2, answer.size());
        PkfieldsblobsKey key = new PkfieldsblobsKey();
        key.setId1(5);
        key.setId2(6);
        int rows = dao.deleteByPrimaryKey(key);
        assertEquals(1, rows);
        example = new PkfieldsblobsExample();
        answer = dao.selectByExampleWithoutBLOBs(example);
        assertEquals(1, answer.size());
    } catch (Exception e) {
        fail(e.getMessage());
    }
}
Also used : Pkfieldsblobs(mbg.test.ib2j5.generated.hierarchical.model.Pkfieldsblobs) PkfieldsblobsKey(mbg.test.ib2j5.generated.hierarchical.model.PkfieldsblobsKey) PkfieldsblobsExample(mbg.test.ib2j5.generated.hierarchical.model.PkfieldsblobsExample) PkfieldsblobsWithBLOBs(mbg.test.ib2j5.generated.hierarchical.model.PkfieldsblobsWithBLOBs) PkfieldsblobsDAO(mbg.test.ib2j5.generated.hierarchical.dao.PkfieldsblobsDAO) Test(org.junit.Test)

Example 10 with PkfieldsblobsKey

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

the class HierarchicalJava5Test method testPKFieldsBlobsUpdateByPrimaryKeyWithBLOBs.

@Test
public void testPKFieldsBlobsUpdateByPrimaryKeyWithBLOBs() {
    PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
    try {
        PkfieldsblobsWithBLOBs record = new PkfieldsblobsWithBLOBs();
        record.setId1(3);
        record.setId2(4);
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setBlob1(generateRandomBlob());
        dao.insert(record);
        PkfieldsblobsWithBLOBs updateRecord = new PkfieldsblobsWithBLOBs();
        updateRecord.setId1(3);
        updateRecord.setId2(4);
        updateRecord.setFirstname("Scott");
        updateRecord.setLastname("Jones");
        updateRecord.setBlob1(generateRandomBlob());
        int rows = dao.updateByPrimaryKey(updateRecord);
        assertEquals(1, rows);
        PkfieldsblobsKey key = new PkfieldsblobsKey();
        key.setId1(3);
        key.setId2(4);
        PkfieldsblobsWithBLOBs newRecord = dao.selectByPrimaryKey(key);
        assertEquals(updateRecord.getFirstname(), newRecord.getFirstname());
        assertEquals(updateRecord.getLastname(), newRecord.getLastname());
        assertEquals(record.getId1(), newRecord.getId1());
        assertEquals(record.getId2(), newRecord.getId2());
        assertTrue(blobsAreEqual(updateRecord.getBlob1(), newRecord.getBlob1()));
    } catch (Exception e) {
        fail(e.getMessage());
    }
}
Also used : PkfieldsblobsKey(mbg.test.ib2j5.generated.hierarchical.model.PkfieldsblobsKey) PkfieldsblobsWithBLOBs(mbg.test.ib2j5.generated.hierarchical.model.PkfieldsblobsWithBLOBs) PkfieldsblobsDAO(mbg.test.ib2j5.generated.hierarchical.dao.PkfieldsblobsDAO) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)15 SQLException (java.sql.SQLException)5 PkfieldsblobsDAO (mbg.test.ib2j2.generated.conditional.dao.PkfieldsblobsDAO)5 Pkfieldsblobs (mbg.test.ib2j2.generated.conditional.model.Pkfieldsblobs)5 PkfieldsblobsKey (mbg.test.ib2j2.generated.conditional.model.PkfieldsblobsKey)5 PkfieldsblobsDAO (mbg.test.ib2j5.generated.conditional.dao.PkfieldsblobsDAO)5 Pkfieldsblobs (mbg.test.ib2j5.generated.conditional.model.Pkfieldsblobs)5 PkfieldsblobsKey (mbg.test.ib2j5.generated.conditional.model.PkfieldsblobsKey)5 PkfieldsblobsDAO (mbg.test.ib2j5.generated.hierarchical.dao.PkfieldsblobsDAO)5 PkfieldsblobsKey (mbg.test.ib2j5.generated.hierarchical.model.PkfieldsblobsKey)5 PkfieldsblobsWithBLOBs (mbg.test.ib2j5.generated.hierarchical.model.PkfieldsblobsWithBLOBs)5 PkfieldsblobsMapper (mbg.test.mb3.generated.conditional.mapper.PkfieldsblobsMapper)5 Pkfieldsblobs (mbg.test.mb3.generated.conditional.model.Pkfieldsblobs)5 PkfieldsblobsKey (mbg.test.mb3.generated.conditional.model.PkfieldsblobsKey)5 SqlSession (org.apache.ibatis.session.SqlSession)5 Pkfieldsblobs (mbg.test.ib2j5.generated.hierarchical.model.Pkfieldsblobs)3 List (java.util.List)2 PkfieldsblobsExample (mbg.test.ib2j2.generated.conditional.model.PkfieldsblobsExample)2 PkfieldsblobsExample (mbg.test.ib2j5.generated.conditional.model.PkfieldsblobsExample)2 PkfieldsblobsExample (mbg.test.ib2j5.generated.hierarchical.model.PkfieldsblobsExample)2