use of mbg.test.mb3.generated.annotated.conditional.model.Fieldsblobs in project generator by mybatis.
the class HierarchicalJava5Test method testFieldsBlobsSelectByExampleWithoutBlobs.
@Test
public void testFieldsBlobsSelectByExampleWithoutBlobs() {
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
FieldsblobsMapper mapper = sqlSession.getMapper(FieldsblobsMapper.class);
FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs("Jeff", "Smith", generateRandomBlob(), generateRandomBlob(), null);
mapper.insert(record);
record = new FieldsblobsWithBLOBs("Scott", "Jones", generateRandomBlob(), generateRandomBlob(), null);
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();
}
}
use of mbg.test.mb3.generated.annotated.conditional.model.Fieldsblobs in project generator by mybatis.
the class UpdateByExampleTest method testFieldsBlobsUpdateByExampleWithoutBLOBs.
@Test
public void testFieldsBlobsUpdateByExampleWithoutBLOBs() {
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
FieldsblobsMapper mapper = sqlSession.getMapper(FieldsblobsMapper.class);
Fieldsblobs record = new Fieldsblobs();
record.setFirstname("Jeff");
record.setLastname("Smith");
record.setBlob1(generateRandomBlob());
record.setBlob2(generateRandomBlob());
mapper.insert(record);
record = new Fieldsblobs();
record.setFirstname("Scott");
record.setLastname("Jones");
record.setBlob1(generateRandomBlob());
record.setBlob2(generateRandomBlob());
mapper.insert(record);
Fieldsblobs newRecord = new Fieldsblobs();
newRecord.setFirstname("Scott");
newRecord.setLastname("Doe");
FieldsblobsExample example = new FieldsblobsExample();
example.createCriteria().andFirstnameLike("S%");
int rows = mapper.updateByExample(newRecord, example);
assertEquals(1, rows);
List<Fieldsblobs> answer = mapper.selectByExampleWithBLOBs(example);
assertEquals(1, answer.size());
Fieldsblobs returnedRecord = answer.get(0);
assertEquals(newRecord.getFirstname(), returnedRecord.getFirstname());
assertEquals(newRecord.getLastname(), returnedRecord.getLastname());
assertTrue(blobsAreEqual(record.getBlob1(), returnedRecord.getBlob1()));
assertTrue(blobsAreEqual(record.getBlob2(), returnedRecord.getBlob2()));
} finally {
sqlSession.close();
}
}
use of mbg.test.mb3.generated.annotated.conditional.model.Fieldsblobs in project generator by mybatis.
the class UpdateByExampleTest method testFieldsBlobsUpdateByExampleWithBLOBs.
@Test
public void testFieldsBlobsUpdateByExampleWithBLOBs() {
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
FieldsblobsMapper mapper = sqlSession.getMapper(FieldsblobsMapper.class);
Fieldsblobs record = new Fieldsblobs();
record.setFirstname("Jeff");
record.setLastname("Smith");
record.setBlob1(generateRandomBlob());
record.setBlob2(generateRandomBlob());
mapper.insert(record);
record = new Fieldsblobs();
record.setFirstname("Scott");
record.setLastname("Jones");
record.setBlob1(generateRandomBlob());
record.setBlob2(generateRandomBlob());
mapper.insert(record);
Fieldsblobs newRecord = new Fieldsblobs();
newRecord.setFirstname("Scott");
newRecord.setLastname("Doe");
FieldsblobsExample example = new FieldsblobsExample();
example.createCriteria().andFirstnameLike("S%");
int rows = mapper.updateByExampleWithBLOBs(newRecord, example);
assertEquals(1, rows);
List<Fieldsblobs> answer = mapper.selectByExampleWithBLOBs(example);
assertEquals(1, answer.size());
Fieldsblobs returnedRecord = answer.get(0);
assertEquals(newRecord.getFirstname(), returnedRecord.getFirstname());
assertEquals(newRecord.getLastname(), returnedRecord.getLastname());
assertNull(returnedRecord.getBlob1());
assertNull(returnedRecord.getBlob2());
} finally {
sqlSession.close();
}
}
use of mbg.test.mb3.generated.annotated.conditional.model.Fieldsblobs in project generator by mybatis.
the class UpdateByExampleTest method testFieldsBlobsUpdateByExampleWithoutBLOBs.
@Test
public void testFieldsBlobsUpdateByExampleWithoutBLOBs() {
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
FieldsblobsMapper mapper = sqlSession.getMapper(FieldsblobsMapper.class);
FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs("Jeff", "Smith", generateRandomBlob(), generateRandomBlob(), null);
mapper.insert(record);
record = new FieldsblobsWithBLOBs("Scott", "Jones", generateRandomBlob(), generateRandomBlob(), null);
mapper.insert(record);
Fieldsblobs newRecord = new Fieldsblobs("Scott", "Doe");
FieldsblobsExample example = new FieldsblobsExample();
example.createCriteria().andFirstnameLike("S%");
int rows = mapper.updateByExample(newRecord, example);
assertEquals(1, rows);
List<FieldsblobsWithBLOBs> answer = mapper.selectByExampleWithBLOBs(example);
assertEquals(1, answer.size());
FieldsblobsWithBLOBs returnedRecord = answer.get(0);
assertEquals(newRecord.getFirstname(), returnedRecord.getFirstname());
assertEquals(newRecord.getLastname(), returnedRecord.getLastname());
assertTrue(blobsAreEqual(record.getBlob1(), returnedRecord.getBlob1()));
assertTrue(blobsAreEqual(record.getBlob2(), returnedRecord.getBlob2()));
} finally {
sqlSession.close();
}
}
use of mbg.test.mb3.generated.annotated.conditional.model.Fieldsblobs in project generator by mybatis.
the class HierarchicalJava5Test 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