Search in sources :

Example 31 with Fieldsblobs

use of mbg.test.ib2j5.generated.flat.model.Fieldsblobs in project generator by mybatis.

the class FlatJava5Test method testFieldsBlobsSelectByExampleWithoutBlobs.

@Test
public void testFieldsBlobsSelectByExampleWithoutBlobs() {
    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);
        FieldsblobsExample example = new FieldsblobsExample();
        example.createCriteria().andFirstnameLike("S%");
        List<Fieldsblobs> answer = mapper.selectByExample(example);
        assertEquals(1, answer.size());
        Fieldsblobs newRecord = answer.get(0);
        assertEquals(record.getFirstname(), newRecord.getFirstname());
        assertEquals(record.getLastname(), newRecord.getLastname());
        assertNull(newRecord.getBlob1());
        assertNull(newRecord.getBlob2());
    } finally {
        sqlSession.close();
    }
}
Also used : SqlSession(org.apache.ibatis.session.SqlSession) FieldsblobsExample(mbg.test.mb3.generated.flat.model.FieldsblobsExample) Fieldsblobs(mbg.test.mb3.generated.flat.model.Fieldsblobs) FieldsblobsMapper(mbg.test.mb3.generated.flat.mapper.FieldsblobsMapper) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)22 SQLException (java.sql.SQLException)20 FieldsblobsDAO (mbg.test.ib2j2.generated.flat.dao.FieldsblobsDAO)9 Fieldsblobs (mbg.test.ib2j2.generated.flat.model.Fieldsblobs)9 FieldsblobsExample (mbg.test.ib2j2.generated.flat.model.FieldsblobsExample)9 List (java.util.List)8 FieldsblobsDAO (mbg.test.ib2j5.generated.flat.dao.FieldsblobsDAO)8 Fieldsblobs (mbg.test.ib2j5.generated.flat.model.Fieldsblobs)8 FieldsblobsExample (mbg.test.ib2j5.generated.flat.model.FieldsblobsExample)8 FieldsblobsMapper (mbg.test.mb3.generated.flat.mapper.FieldsblobsMapper)8 Fieldsblobs (mbg.test.mb3.generated.flat.model.Fieldsblobs)8 FieldsblobsExample (mbg.test.mb3.generated.flat.model.FieldsblobsExample)8 SqlSession (org.apache.ibatis.session.SqlSession)8 ArrayList (java.util.ArrayList)5 FieldsblobsDAO (mbg.test.ib2j5.generated.conditional.dao.FieldsblobsDAO)3 Fieldsblobs (mbg.test.ib2j5.generated.conditional.model.Fieldsblobs)3 FieldsblobsExample (mbg.test.ib2j5.generated.conditional.model.FieldsblobsExample)3 FieldsblobsWithBLOBs (mbg.test.ib2j5.generated.conditional.model.FieldsblobsWithBLOBs)3 FieldsblobsDAO (mbg.test.ib2j5.generated.hierarchical.dao.FieldsblobsDAO)3 Fieldsblobs (mbg.test.ib2j5.generated.hierarchical.model.Fieldsblobs)3