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());
}
}
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());
}
}
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());
}
}
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());
}
}
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());
}
}
Aggregations