use of mbg.test.mb3.generated.dsql.mapper.FieldsblobsMapper in project generator by mybatis.
the class DynamicSqlTest method testFieldsBlobsInsert.
@Test
public void testFieldsBlobsInsert() {
try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
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);
List<Fieldsblobs> answer = mapper.select(SelectDSLCompleter.allRows());
assertEquals(1, answer.size());
Fieldsblobs 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()));
}
}
use of mbg.test.mb3.generated.dsql.mapper.FieldsblobsMapper in project generator by mybatis.
the class DynamicSqlTest method testFieldsBlobsdelete.
@Test
public void testFieldsBlobsdelete() {
try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
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);
List<Fieldsblobs> answer = mapper.select(SelectDSLCompleter.allRows());
assertEquals(2, answer.size());
int rows = mapper.delete(dsl -> dsl.where(fieldsblobs.firstname, isLike("S%")));
assertEquals(1, rows);
answer = mapper.select(SelectDSLCompleter.allRows());
assertEquals(1, answer.size());
}
}
use of mbg.test.mb3.generated.dsql.mapper.FieldsblobsMapper in project generator by mybatis.
the class DynamicSqlTest method testFieldsBlobsSelectByExampleWithBlobsNoCriteria.
@Test
public void testFieldsBlobsSelectByExampleWithBlobsNoCriteria() {
try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
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);
List<Fieldsblobs> answer = mapper.select(SelectDSLCompleter.allRows());
assertEquals(2, answer.size());
}
}
use of mbg.test.mb3.generated.dsql.mapper.FieldsblobsMapper in project generator by mybatis.
the class DynamicSqlTest method testFieldsBlobsSelectByExampleWithBlobs.
@Test
public void testFieldsBlobsSelectByExampleWithBlobs() {
try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
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);
List<Fieldsblobs> answer = mapper.select(dsl -> dsl.where(fieldsblobs.firstname, isLike("S%")));
assertEquals(1, answer.size());
Fieldsblobs newRecord = answer.get(0);
assertEquals(record.getFirstname(), newRecord.getFirstname());
assertEquals(record.getLastname(), newRecord.getLastname());
assertTrue(blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
assertTrue(blobsAreEqual(record.getBlob2(), newRecord.getBlob2()));
}
}
use of mbg.test.mb3.generated.dsql.mapper.FieldsblobsMapper in project generator by mybatis.
the class HierarchicalJava5Test method testFieldsBlobsSelectByExampleWithBlobsNoCriteria.
@Test
public void testFieldsBlobsSelectByExampleWithBlobsNoCriteria() {
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();
List<FieldsblobsWithBLOBs> answer = mapper.selectByExampleWithBLOBs(example);
assertEquals(2, answer.size());
} finally {
sqlSession.close();
}
}
Aggregations