use of mbg.test.ib2j2.generated.conditional.dao.FieldsblobsDAO in project generator by mybatis.
the class ConditionalJava5Test method testFieldsBlobsInsert.
@Test
public void testFieldsBlobsInsert() {
FieldsblobsDAO dao = getFieldsblobsDAO();
try {
FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs();
record.setFirstname("Jeff");
record.setLastname("Smith");
record.setBlob1(generateRandomBlob());
record.setBlob2(generateRandomBlob());
dao.insert(record);
FieldsblobsExample example = new FieldsblobsExample();
List<FieldsblobsWithBLOBs> answer = dao.selectByExampleWithBLOBs(example);
assertEquals(1, answer.size());
FieldsblobsWithBLOBs returnedRecord = answer.get(0);
assertEquals(record.getFirstname(), returnedRecord.getFirstname());
assertEquals(record.getLastname(), returnedRecord.getLastname());
assertTrue(blobsAreEqual(record.getBlob1(), returnedRecord.getBlob1()));
assertTrue(blobsAreEqual(record.getBlob2(), returnedRecord.getBlob2()));
} catch (SQLException e) {
fail(e.getMessage());
}
}
use of mbg.test.ib2j2.generated.conditional.dao.FieldsblobsDAO in project generator by mybatis.
the class HierarchicalJava2Test method testFieldsBlobsDeleteByExample.
public void testFieldsBlobsDeleteByExample() {
FieldsblobsDAO dao = getFieldsblobsDAO();
try {
FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs();
record.setFirstname("Jeff");
record.setLastname("Smith");
record.setBlob1(TestUtilities.generateRandomBlob());
record.setBlob2(TestUtilities.generateRandomBlob());
dao.insert(record);
record = new FieldsblobsWithBLOBs();
record.setFirstname("Scott");
record.setLastname("Jones");
record.setBlob1(TestUtilities.generateRandomBlob());
record.setBlob2(TestUtilities.generateRandomBlob());
dao.insert(record);
FieldsblobsExample example = new FieldsblobsExample();
List answer = dao.selectByExampleWithoutBLOBs(example);
assertEquals(2, answer.size());
example = new FieldsblobsExample();
example.createCriteria().andFirstnameLike("S%");
int rows = dao.deleteByExample(example);
assertEquals(1, rows);
example = new FieldsblobsExample();
answer = dao.selectByExampleWithoutBLOBs(example);
assertEquals(1, answer.size());
} catch (SQLException e) {
fail(e.getMessage());
}
}
Aggregations