use of mbg.test.ib2j5.generated.conditional.model.Pkblobs in project generator by mybatis.
the class FlatJava5Test method testPKBlobsDeleteByPrimaryKey.
@Test
public void testPKBlobsDeleteByPrimaryKey() {
PkblobsDAO dao = getPkblobsDAO();
try {
Pkblobs record = new Pkblobs();
record.setId(3);
record.setBlob1(generateRandomBlob());
record.setBlob2(generateRandomBlob());
dao.insert(record);
PkblobsExample example = new PkblobsExample();
List<Pkblobs> answer = dao.selectByExampleWithoutBLOBs(example);
assertEquals(1, answer.size());
int rows = dao.deleteByPrimaryKey(3);
assertEquals(1, rows);
example = new PkblobsExample();
answer = dao.selectByExampleWithoutBLOBs(example);
assertEquals(0, answer.size());
} catch (SQLException e) {
fail(e.getMessage());
}
}
use of mbg.test.ib2j5.generated.conditional.model.Pkblobs in project generator by mybatis.
the class UpdateByPrimaryKeyTest method testPKBlobsUpdateByPrimaryKeySelective.
public void testPKBlobsUpdateByPrimaryKeySelective() {
PkblobsDAO dao = getPkblobsDAO();
try {
Pkblobs record = new Pkblobs();
record.setId(new Integer(3));
record.setBlob1(TestUtilities.generateRandomBlob());
record.setBlob2(TestUtilities.generateRandomBlob());
dao.insert(record);
Pkblobs newRecord = new Pkblobs();
newRecord.setId(new Integer(3));
newRecord.setBlob2(TestUtilities.generateRandomBlob());
dao.updateByPrimaryKeySelective(newRecord);
Pkblobs returnedRecord = dao.selectByPrimaryKey(new Integer(3));
assertNotNull(returnedRecord);
assertEquals(record.getId(), returnedRecord.getId());
assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), returnedRecord.getBlob1()));
assertTrue(TestUtilities.blobsAreEqual(newRecord.getBlob2(), returnedRecord.getBlob2()));
} catch (Exception e) {
fail(e.getMessage());
}
}
use of mbg.test.ib2j5.generated.conditional.model.Pkblobs in project generator by mybatis.
the class ConditionalJava5Test method testPKBlobsDeleteByPrimaryKey.
@Test
public void testPKBlobsDeleteByPrimaryKey() {
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
PkblobsMapper mapper = sqlSession.getMapper(PkblobsMapper.class);
Pkblobs record = new Pkblobs();
record.setId(3);
record.setBlob1(generateRandomBlob());
record.setBlob2(generateRandomBlob());
mapper.insert(record);
PkblobsExample example = new PkblobsExample();
List<Pkblobs> answer = mapper.selectByExample(example);
assertEquals(1, answer.size());
int rows = mapper.deleteByPrimaryKey(3);
assertEquals(1, rows);
example = new PkblobsExample();
answer = mapper.selectByExample(example);
assertEquals(0, answer.size());
} finally {
sqlSession.close();
}
}
use of mbg.test.ib2j5.generated.conditional.model.Pkblobs in project generator by mybatis.
the class ConditionalJava5Test method testPKBlobsCountByExample.
@Test
public void testPKBlobsCountByExample() {
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
PkblobsMapper mapper = sqlSession.getMapper(PkblobsMapper.class);
Pkblobs record = new Pkblobs();
record.setId(3);
record.setBlob1(generateRandomBlob());
record.setBlob2(generateRandomBlob());
mapper.insert(record);
record = new Pkblobs();
record.setId(6);
record.setBlob1(generateRandomBlob());
record.setBlob2(generateRandomBlob());
mapper.insert(record);
PkblobsExample example = new PkblobsExample();
example.createCriteria().andIdLessThan(4);
long rows = mapper.countByExample(example);
assertEquals(1, rows);
example.clear();
rows = mapper.countByExample(example);
assertEquals(2, rows);
} finally {
sqlSession.close();
}
}
use of mbg.test.ib2j5.generated.conditional.model.Pkblobs in project generator by mybatis.
the class ConditionalJava5Test method testPKBlobsSelectByExampleWithoutBlobs.
@Test
public void testPKBlobsSelectByExampleWithoutBlobs() {
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
PkblobsMapper mapper = sqlSession.getMapper(PkblobsMapper.class);
Pkblobs record = new Pkblobs();
record.setId(3);
record.setBlob1(generateRandomBlob());
record.setBlob2(generateRandomBlob());
mapper.insert(record);
record = new Pkblobs();
record.setId(6);
record.setBlob1(generateRandomBlob());
record.setBlob2(generateRandomBlob());
mapper.insert(record);
PkblobsExample example = new PkblobsExample();
example.createCriteria().andIdGreaterThan(4);
List<Pkblobs> answer = mapper.selectByExample(example);
assertEquals(1, answer.size());
Pkblobs key = answer.get(0);
assertEquals(6, key.getId().intValue());
assertNull(key.getBlob1());
assertNull(key.getBlob2());
} finally {
sqlSession.close();
}
}
Aggregations