Search in sources :

Example 31 with PkblobsDAO

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

the class HierarchicalJava2Test method testPKBlobsSelectByExampleWithoutBlobsNoCriteria.

public void testPKBlobsSelectByExampleWithoutBlobsNoCriteria() {
    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();
        List answer = dao.selectByExampleWithoutBLOBs(example);
        assertEquals(2, answer.size());
    } 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) ArrayList(java.util.ArrayList) List(java.util.List)

Example 32 with PkblobsDAO

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

the class HierarchicalJava2Test method testPKBlobsDeleteByExample.

public void testPKBlobsDeleteByExample() {
    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();
        List answer = dao.selectByExampleWithoutBLOBs(example);
        assertEquals(2, answer.size());
        example = new PkblobsExample();
        example.createCriteria().andIdLessThan(new Integer(4));
        int rows = dao.deleteByExample(example);
        assertEquals(1, rows);
        example = new PkblobsExample();
        answer = dao.selectByExampleWithoutBLOBs(example);
        assertEquals(1, answer.size());
    } 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) ArrayList(java.util.ArrayList) List(java.util.List)

Example 33 with PkblobsDAO

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

the class UpdateByExampleTest method testPKBlobsUpdateByExampleWithoutBLOBs.

public void testPKBlobsUpdateByExampleWithoutBLOBs() {
    PkblobsDAO dao = getPkblobsDAO();
    try {
        Pkblobs record = new Pkblobs();
        record.setId(new Integer(3));
        record.setBlob1(TestUtilities.generateRandomBlob());
        record.setBlob2(TestUtilities.generateRandomBlob());
        dao.insert(record);
        record = new Pkblobs();
        record.setId(new Integer(6));
        record.setBlob1(TestUtilities.generateRandomBlob());
        record.setBlob2(TestUtilities.generateRandomBlob());
        dao.insert(record);
        Pkblobs newRecord = new Pkblobs();
        newRecord.setId(new Integer(8));
        PkblobsExample example = new PkblobsExample();
        example.createCriteria().andIdGreaterThan(new Integer(4));
        int rows = dao.updateByExampleWithoutBLOBs(newRecord, example);
        assertEquals(1, rows);
        List answer = dao.selectByExampleWithBLOBs(example);
        assertEquals(1, answer.size());
        Pkblobs returnedRecord = (Pkblobs) answer.get(0);
        assertEquals(new Integer(8), returnedRecord.getId());
        assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), returnedRecord.getBlob1()));
        assertTrue(TestUtilities.blobsAreEqual(record.getBlob2(), returnedRecord.getBlob2()));
    } catch (SQLException e) {
        fail(e.getMessage());
    }
}
Also used : PkblobsDAO(mbg.test.ib2j2.generated.flat.dao.PkblobsDAO) PkblobsExample(mbg.test.ib2j2.generated.flat.model.PkblobsExample) SQLException(java.sql.SQLException) List(java.util.List) Pkblobs(mbg.test.ib2j2.generated.flat.model.Pkblobs)

Example 34 with PkblobsDAO

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

the class UpdateByExampleTest method testPKBlobsUpdateByExampleSelective.

public void testPKBlobsUpdateByExampleSelective() {
    PkblobsDAO dao = getPkblobsDAO();
    try {
        Pkblobs record = new Pkblobs();
        record.setId(new Integer(3));
        record.setBlob1(TestUtilities.generateRandomBlob());
        record.setBlob2(TestUtilities.generateRandomBlob());
        dao.insert(record);
        record = new Pkblobs();
        record.setId(new Integer(6));
        record.setBlob1(TestUtilities.generateRandomBlob());
        record.setBlob2(TestUtilities.generateRandomBlob());
        dao.insert(record);
        Pkblobs newRecord = new Pkblobs();
        newRecord.setBlob1(TestUtilities.generateRandomBlob());
        PkblobsExample example = new PkblobsExample();
        example.createCriteria().andIdGreaterThan(new Integer(4));
        int rows = dao.updateByExampleSelective(newRecord, example);
        assertEquals(1, rows);
        List answer = dao.selectByExampleWithBLOBs(example);
        assertEquals(1, answer.size());
        Pkblobs returnedRecord = (Pkblobs) answer.get(0);
        assertEquals(new Integer(6), returnedRecord.getId());
        assertTrue(TestUtilities.blobsAreEqual(newRecord.getBlob1(), returnedRecord.getBlob1()));
        assertTrue(TestUtilities.blobsAreEqual(record.getBlob2(), returnedRecord.getBlob2()));
    } catch (SQLException e) {
        fail(e.getMessage());
    }
}
Also used : PkblobsDAO(mbg.test.ib2j2.generated.flat.dao.PkblobsDAO) PkblobsExample(mbg.test.ib2j2.generated.flat.model.PkblobsExample) SQLException(java.sql.SQLException) List(java.util.List) Pkblobs(mbg.test.ib2j2.generated.flat.model.Pkblobs)

Example 35 with PkblobsDAO

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

the class UpdateByExampleTest method testPKBlobsUpdateByExampleWithBLOBs.

public void testPKBlobsUpdateByExampleWithBLOBs() {
    PkblobsDAO dao = getPkblobsDAO();
    try {
        Pkblobs record = new Pkblobs();
        record.setId(new Integer(3));
        record.setBlob1(TestUtilities.generateRandomBlob());
        record.setBlob2(TestUtilities.generateRandomBlob());
        dao.insert(record);
        record = new Pkblobs();
        record.setId(new Integer(6));
        record.setBlob1(TestUtilities.generateRandomBlob());
        record.setBlob2(TestUtilities.generateRandomBlob());
        dao.insert(record);
        Pkblobs newRecord = new Pkblobs();
        newRecord.setId(new Integer(8));
        PkblobsExample example = new PkblobsExample();
        example.createCriteria().andIdGreaterThan(new Integer(4));
        int rows = dao.updateByExampleWithBLOBs(newRecord, example);
        assertEquals(1, rows);
        List answer = dao.selectByExampleWithBLOBs(example);
        assertEquals(1, answer.size());
        Pkblobs returnedRecord = (Pkblobs) answer.get(0);
        assertEquals(new Integer(8), returnedRecord.getId());
        assertNull(returnedRecord.getBlob1());
        assertNull(returnedRecord.getBlob2());
    } catch (SQLException e) {
        fail(e.getMessage());
    }
}
Also used : PkblobsDAO(mbg.test.ib2j2.generated.flat.dao.PkblobsDAO) PkblobsExample(mbg.test.ib2j2.generated.flat.model.PkblobsExample) SQLException(java.sql.SQLException) List(java.util.List) Pkblobs(mbg.test.ib2j2.generated.flat.model.Pkblobs)

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