use of mbg.test.ib2j5.generated.conditional.model.Fieldsblobs in project generator by mybatis.
the class FlatJava5Test method testFieldsBlobsSelectByExampleWithBlobsNoCriteria.
@Test
public void testFieldsBlobsSelectByExampleWithBlobsNoCriteria() {
FieldsblobsDAO dao = getFieldsblobsDAO();
try {
Fieldsblobs record = new Fieldsblobs();
record.setFirstname("Jeff");
record.setLastname("Smith");
record.setBlob1(generateRandomBlob());
record.setBlob2(generateRandomBlob());
dao.insert(record);
record = new Fieldsblobs();
record.setFirstname("Scott");
record.setLastname("Jones");
record.setBlob1(generateRandomBlob());
record.setBlob2(generateRandomBlob());
dao.insert(record);
FieldsblobsExample example = new FieldsblobsExample();
example.createCriteria();
List<Fieldsblobs> answer = dao.selectByExampleWithBLOBs(example);
assertEquals(2, answer.size());
} catch (SQLException e) {
fail(e.getMessage());
}
}
use of mbg.test.ib2j5.generated.conditional.model.Fieldsblobs in project generator by mybatis.
the class ConditionalJava5Test method testFieldsBlobsDeleteByExample.
@Test
public void testFieldsBlobsDeleteByExample() {
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
FieldsblobsMapper mapper = sqlSession.getMapper(FieldsblobsMapper.class);
FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs();
record.setFirstname("Jeff");
record.setLastname("Smith");
record.setBlob1(generateRandomBlob());
record.setBlob2(generateRandomBlob());
mapper.insert(record);
record = new FieldsblobsWithBLOBs();
record.setFirstname("Scott");
record.setLastname("Jones");
record.setBlob1(generateRandomBlob());
record.setBlob2(generateRandomBlob());
mapper.insert(record);
FieldsblobsExample example = new FieldsblobsExample();
List<Fieldsblobs> answer = mapper.selectByExample(example);
assertEquals(2, answer.size());
example = new FieldsblobsExample();
example.createCriteria().andFirstnameLike("S%");
int rows = mapper.deleteByExample(example);
assertEquals(1, rows);
example = new FieldsblobsExample();
answer = mapper.selectByExample(example);
assertEquals(1, answer.size());
} finally {
sqlSession.close();
}
}
use of mbg.test.ib2j5.generated.conditional.model.Fieldsblobs in project generator by mybatis.
the class ConditionalJava5Test method testFieldsBlobsSelectByExampleWithoutBlobs.
@Test
public void testFieldsBlobsSelectByExampleWithoutBlobs() {
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
FieldsblobsMapper mapper = sqlSession.getMapper(FieldsblobsMapper.class);
FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs();
record.setFirstname("Jeff");
record.setLastname("Smith");
record.setBlob1(generateRandomBlob());
record.setBlob2(generateRandomBlob());
mapper.insert(record);
record = new FieldsblobsWithBLOBs();
record.setFirstname("Scott");
record.setLastname("Jones");
record.setBlob1(generateRandomBlob());
record.setBlob2(generateRandomBlob());
mapper.insert(record);
FieldsblobsExample example = new FieldsblobsExample();
example.createCriteria().andFirstnameLike("S%");
List<Fieldsblobs> answer = mapper.selectByExample(example);
assertEquals(1, answer.size());
Fieldsblobs newRecord = answer.get(0);
assertFalse(newRecord instanceof FieldsblobsWithBLOBs);
assertEquals(record.getFirstname(), newRecord.getFirstname());
assertEquals(record.getLastname(), newRecord.getLastname());
} finally {
sqlSession.close();
}
}
Aggregations