Search in sources :

Example 51 with PkblobsDAO

use of mbg.test.ib2j2.generated.conditional.dao.PkblobsDAO in project generator by mybatis.

the class HierarchicalJava2Test method testPKBlobsUpdateByPrimaryKeyWithBLOBs.

public void testPKBlobsUpdateByPrimaryKeyWithBLOBs() {
    PkblobsDAO dao = getPkblobsDAO();
    try {
        PkblobsWithBLOBs record = new PkblobsWithBLOBs();
        record.setId(new Integer(3));
        record.setBlob1(TestUtilities.generateRandomBlob());
        record.setBlob2(TestUtilities.generateRandomBlob());
        dao.insert(record);
        record = new PkblobsWithBLOBs();
        record.setId(new Integer(3));
        record.setBlob1(TestUtilities.generateRandomBlob());
        record.setBlob2(TestUtilities.generateRandomBlob());
        int rows = dao.updateByPrimaryKey(record);
        assertEquals(1, rows);
        PkblobsKey key = new PkblobsKey();
        key.setId(new Integer(3));
        PkblobsWithBLOBs newRecord = dao.selectByPrimaryKey(key);
        assertNotNull(newRecord);
        assertEquals(record.getId(), newRecord.getId());
        assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
        assertTrue(TestUtilities.blobsAreEqual(record.getBlob2(), newRecord.getBlob2()));
    } catch (SQLException e) {
        fail(e.getMessage());
    }
}
Also used : PkblobsDAO(mbg.test.ib2j2.generated.hierarchical.dao.PkblobsDAO) PkblobsWithBLOBs(mbg.test.ib2j2.generated.hierarchical.model.PkblobsWithBLOBs) PkblobsKey(mbg.test.ib2j2.generated.hierarchical.model.PkblobsKey) SQLException(java.sql.SQLException)

Example 52 with PkblobsDAO

use of mbg.test.ib2j2.generated.conditional.dao.PkblobsDAO in project generator by mybatis.

the class HierarchicalJava2Test method testPKBlobsSelectByPrimaryKey.

public void testPKBlobsSelectByPrimaryKey() {
    PkblobsDAO dao = getPkblobsDAO();
    try {
        PkblobsWithBLOBs record = new PkblobsWithBLOBs();
        record.setId(new Integer(3));
        record.setBlob1(TestUtilities.generateRandomBlob());
        record.setBlob2(TestUtilities.generateRandomBlob());
        dao.insert(record);
        record = new PkblobsWithBLOBs();
        record.setId(new Integer(6));
        record.setBlob1(TestUtilities.generateRandomBlob());
        record.setBlob2(TestUtilities.generateRandomBlob());
        dao.insert(record);
        PkblobsKey key = new PkblobsKey();
        key.setId(new Integer(6));
        PkblobsWithBLOBs newRecord = dao.selectByPrimaryKey(key);
        assertNotNull(newRecord);
        assertEquals(record.getId(), newRecord.getId());
        assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
        assertTrue(TestUtilities.blobsAreEqual(record.getBlob2(), newRecord.getBlob2()));
    } catch (SQLException e) {
        fail(e.getMessage());
    }
}
Also used : PkblobsDAO(mbg.test.ib2j2.generated.hierarchical.dao.PkblobsDAO) PkblobsWithBLOBs(mbg.test.ib2j2.generated.hierarchical.model.PkblobsWithBLOBs) PkblobsKey(mbg.test.ib2j2.generated.hierarchical.model.PkblobsKey) SQLException(java.sql.SQLException)

Example 53 with PkblobsDAO

use of mbg.test.ib2j2.generated.conditional.dao.PkblobsDAO in project generator by mybatis.

the class HierarchicalJava2Test method testPKBlobsCountByExample.

public void testPKBlobsCountByExample() {
    PkblobsDAO dao = getPkblobsDAO();
    try {
        PkblobsWithBLOBs record = new PkblobsWithBLOBs();
        record.setId(new Integer(3));
        record.setBlob1(TestUtilities.generateRandomBlob());
        record.setBlob2(TestUtilities.generateRandomBlob());
        dao.insert(record);
        record = new PkblobsWithBLOBs();
        record.setId(new Integer(6));
        record.setBlob1(TestUtilities.generateRandomBlob());
        record.setBlob2(TestUtilities.generateRandomBlob());
        dao.insert(record);
        PkblobsExample example = new PkblobsExample();
        example.createCriteria().andIdLessThan(new Integer(4));
        long rows = dao.countByExample(example);
        assertEquals(1, rows);
        example.clear();
        rows = dao.countByExample(example);
        assertEquals(2, rows);
    } catch (SQLException e) {
        fail(e.getMessage());
    }
}
Also used : PkblobsDAO(mbg.test.ib2j2.generated.hierarchical.dao.PkblobsDAO) PkblobsExample(mbg.test.ib2j2.generated.hierarchical.model.PkblobsExample) PkblobsWithBLOBs(mbg.test.ib2j2.generated.hierarchical.model.PkblobsWithBLOBs) SQLException(java.sql.SQLException)

Aggregations

SQLException (java.sql.SQLException)39 List (java.util.List)27 ArrayList (java.util.ArrayList)15 PkblobsDAO (mbg.test.ib2j2.generated.conditional.dao.PkblobsDAO)13 Pkblobs (mbg.test.ib2j2.generated.conditional.model.Pkblobs)13 PkblobsDAO (mbg.test.ib2j2.generated.flat.dao.PkblobsDAO)13 Pkblobs (mbg.test.ib2j2.generated.flat.model.Pkblobs)13 PkblobsDAO (mbg.test.ib2j2.generated.hierarchical.dao.PkblobsDAO)13 PkblobsWithBLOBs (mbg.test.ib2j2.generated.hierarchical.model.PkblobsWithBLOBs)13 PkblobsDAO (mbg.test.ib2j5.generated.conditional.dao.PkblobsDAO)13 Pkblobs (mbg.test.ib2j5.generated.conditional.model.Pkblobs)13 Test (org.junit.Test)13 PkblobsExample (mbg.test.ib2j2.generated.conditional.model.PkblobsExample)10 PkblobsExample (mbg.test.ib2j2.generated.flat.model.PkblobsExample)10 PkblobsExample (mbg.test.ib2j2.generated.hierarchical.model.PkblobsExample)10 PkblobsExample (mbg.test.ib2j5.generated.conditional.model.PkblobsExample)10 PkblobsKey (mbg.test.ib2j2.generated.hierarchical.model.PkblobsKey)6 PkblobsDAOImpl (mbg.test.ib2j2.generated.flat.dao.PkblobsDAOImpl)1