Search in sources :

Example 56 with Fieldsblobs

use of mbg.test.mb3.generated.mixed.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("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();
    }
}
Also used : FieldsblobsWithBLOBs(mbg.test.mb3.generated.conditional.immutable.model.FieldsblobsWithBLOBs) SqlSession(org.apache.ibatis.session.SqlSession) FieldsblobsExample(mbg.test.mb3.generated.conditional.immutable.model.FieldsblobsExample) Fieldsblobs(mbg.test.mb3.generated.conditional.immutable.model.Fieldsblobs) FieldsblobsMapper(mbg.test.mb3.generated.conditional.immutable.mapper.FieldsblobsMapper) Test(org.junit.jupiter.api.Test)

Example 57 with Fieldsblobs

use of mbg.test.mb3.generated.mixed.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();
    }
}
Also used : FieldsblobsWithBLOBs(mbg.test.mb3.generated.conditional.immutable.model.FieldsblobsWithBLOBs) SqlSession(org.apache.ibatis.session.SqlSession) FieldsblobsExample(mbg.test.mb3.generated.conditional.immutable.model.FieldsblobsExample) Fieldsblobs(mbg.test.mb3.generated.conditional.immutable.model.Fieldsblobs) FieldsblobsMapper(mbg.test.mb3.generated.conditional.immutable.mapper.FieldsblobsMapper) Test(org.junit.jupiter.api.Test)

Example 58 with Fieldsblobs

use of mbg.test.mb3.generated.mixed.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();
    }
}
Also used : FieldsblobsWithBLOBs(mbg.test.mb3.generated.mixed.hierarchical.Immutable.Model.FieldsblobsWithBLOBs) SqlSession(org.apache.ibatis.session.SqlSession) FieldsblobsExample(mbg.test.mb3.generated.mixed.hierarchical.Immutable.Model.FieldsblobsExample) Fieldsblobs(mbg.test.mb3.generated.mixed.hierarchical.Immutable.Model.Fieldsblobs) FieldsblobsMapper(mbg.test.mb3.generated.mixed.hierarchical.Immutable.Mapper.FieldsblobsMapper) Test(org.junit.jupiter.api.Test)

Example 59 with Fieldsblobs

use of mbg.test.mb3.generated.mixed.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();
    }
}
Also used : FieldsblobsWithBLOBs(mbg.test.mb3.generated.mixed.hierarchical.Immutable.Model.FieldsblobsWithBLOBs) SqlSession(org.apache.ibatis.session.SqlSession) FieldsblobsExample(mbg.test.mb3.generated.mixed.hierarchical.Immutable.Model.FieldsblobsExample) Fieldsblobs(mbg.test.mb3.generated.mixed.hierarchical.Immutable.Model.Fieldsblobs) FieldsblobsMapper(mbg.test.mb3.generated.mixed.hierarchical.Immutable.Mapper.FieldsblobsMapper) Test(org.junit.jupiter.api.Test)

Example 60 with Fieldsblobs

use of mbg.test.mb3.generated.mixed.conditional.model.Fieldsblobs in project generator by mybatis.

the class SimpleTest method testFieldsblobs.

@Test
public void testFieldsblobs() {
    SqlSession sqlSession = sqlSessionFactory.openSession();
    try {
        FieldsblobsMapper mapper = sqlSession.getMapper(FieldsblobsMapper.class);
        Fieldsblobs record = new Fieldsblobs();
        record.setFirstname("Fred");
        record.setBlob1(TestUtilities.generateRandomBlob());
        mapper.insert(record);
        record = new Fieldsblobs();
        record.setFirstname("Barney");
        record.setBlob1(TestUtilities.generateRandomBlob());
        mapper.insert(record);
        List<Fieldsblobs> records = mapper.selectAll();
        assertEquals(2, records.size());
    } finally {
        sqlSession.close();
    }
}
Also used : SqlSession(org.apache.ibatis.session.SqlSession) Fieldsblobs(mbg.test.mb3.generated.simple.model.Fieldsblobs) FieldsblobsMapper(mbg.test.mb3.generated.simple.mapper.FieldsblobsMapper) Test(org.junit.jupiter.api.Test)

Aggregations

SqlSession (org.apache.ibatis.session.SqlSession)60 Test (org.junit.jupiter.api.Test)60 FieldsblobsMapper (mbg.test.mb3.generated.annotated.flat.mapper.FieldsblobsMapper)8 Fieldsblobs (mbg.test.mb3.generated.annotated.flat.model.Fieldsblobs)8 FieldsblobsExample (mbg.test.mb3.generated.annotated.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 FieldsblobsMapper (mbg.test.mb3.generated.mixed.flat.mapper.FieldsblobsMapper)8 Fieldsblobs (mbg.test.mb3.generated.mixed.flat.model.Fieldsblobs)8 FieldsblobsExample (mbg.test.mb3.generated.mixed.flat.model.FieldsblobsExample)8 FieldsblobsMapper (mbg.test.mb3.generated.dsql.mapper.FieldsblobsMapper)7 Fieldsblobs (mbg.test.mb3.generated.dsql.model.Fieldsblobs)7 FieldsblobsMapper (mbg.test.mb3.generated.annotated.hierarchical.Immutable.Mapper.FieldsblobsMapper)3 Fieldsblobs (mbg.test.mb3.generated.annotated.hierarchical.Immutable.Model.Fieldsblobs)3 FieldsblobsExample (mbg.test.mb3.generated.annotated.hierarchical.Immutable.Model.FieldsblobsExample)3 FieldsblobsWithBLOBs (mbg.test.mb3.generated.annotated.hierarchical.Immutable.Model.FieldsblobsWithBLOBs)3 FieldsblobsMapper (mbg.test.mb3.generated.annotated.hierarchical.mapper.FieldsblobsMapper)3 Fieldsblobs (mbg.test.mb3.generated.annotated.hierarchical.model.Fieldsblobs)3 FieldsblobsExample (mbg.test.mb3.generated.annotated.hierarchical.model.FieldsblobsExample)3