Search in sources :

Example 41 with Pkfieldsblobs

use of mbg.test.mb3.generated.hierarchical.model.Pkfieldsblobs in project generator by mybatis.

the class HierarchicalJava5Test method testPKFieldsBlobsSelectByExampleWithoutBlobs.

@Test
public void testPKFieldsBlobsSelectByExampleWithoutBlobs() {
    SqlSession sqlSession = sqlSessionFactory.openSession();
    try {
        PkfieldsblobsMapper mapper = sqlSession.getMapper(PkfieldsblobsMapper.class);
        PkfieldsblobsWithBLOBs record = new PkfieldsblobsWithBLOBs();
        record.setId1(3);
        record.setId2(4);
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setBlob1(generateRandomBlob());
        mapper.insert(record);
        record = new PkfieldsblobsWithBLOBs();
        record.setId1(5);
        record.setId2(6);
        record.setFirstname("Scott");
        record.setLastname("Jones");
        record.setBlob1(generateRandomBlob());
        mapper.insert(record);
        PkfieldsblobsExample example = new PkfieldsblobsExample();
        example.createCriteria().andId2EqualTo(6);
        List<Pkfieldsblobs> answer = mapper.selectByExample(example);
        assertEquals(1, answer.size());
        Pkfieldsblobs newRecord = answer.get(0);
        assertFalse(newRecord instanceof PkfieldsblobsWithBLOBs);
        assertEquals(record.getId1(), newRecord.getId1());
        assertEquals(record.getId2(), newRecord.getId2());
        assertEquals(record.getFirstname(), newRecord.getFirstname());
        assertEquals(record.getLastname(), newRecord.getLastname());
    } finally {
        sqlSession.close();
    }
}
Also used : Pkfieldsblobs(mbg.test.mb3.generated.annotated.hierarchical.model.Pkfieldsblobs) SqlSession(org.apache.ibatis.session.SqlSession) PkfieldsblobsExample(mbg.test.mb3.generated.annotated.hierarchical.model.PkfieldsblobsExample) PkfieldsblobsWithBLOBs(mbg.test.mb3.generated.annotated.hierarchical.model.PkfieldsblobsWithBLOBs) PkfieldsblobsMapper(mbg.test.mb3.generated.annotated.hierarchical.mapper.PkfieldsblobsMapper) Test(org.junit.Test)

Example 42 with Pkfieldsblobs

use of mbg.test.mb3.generated.hierarchical.model.Pkfieldsblobs in project generator by mybatis.

the class ConditionalJava5Test method testPKFieldsBlobsCountByExample.

@Test
public void testPKFieldsBlobsCountByExample() {
    SqlSession sqlSession = sqlSessionFactory.openSession();
    try {
        PkfieldsblobsMapper mapper = sqlSession.getMapper(PkfieldsblobsMapper.class);
        Pkfieldsblobs record = new Pkfieldsblobs();
        record.setId1(3);
        record.setId2(4);
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setBlob1(generateRandomBlob());
        mapper.insert(record);
        record = new Pkfieldsblobs();
        record.setId1(5);
        record.setId2(6);
        record.setFirstname("Scott");
        record.setLastname("Jones");
        record.setBlob1(generateRandomBlob());
        mapper.insert(record);
        PkfieldsblobsExample example = new PkfieldsblobsExample();
        example.createCriteria().andId1NotEqualTo(3);
        long rows = mapper.countByExample(example);
        assertEquals(1, rows);
        example.clear();
        rows = mapper.countByExample(example);
        assertEquals(2, rows);
    } finally {
        sqlSession.close();
    }
}
Also used : Pkfieldsblobs(mbg.test.mb3.generated.annotated.conditional.model.Pkfieldsblobs) SqlSession(org.apache.ibatis.session.SqlSession) PkfieldsblobsExample(mbg.test.mb3.generated.annotated.conditional.model.PkfieldsblobsExample) PkfieldsblobsMapper(mbg.test.mb3.generated.annotated.conditional.mapper.PkfieldsblobsMapper) Test(org.junit.Test)

Example 43 with Pkfieldsblobs

use of mbg.test.mb3.generated.hierarchical.model.Pkfieldsblobs in project generator by mybatis.

the class HierarchicalJava5Test method testPKFieldsBlobsDeleteByExample.

@Test
public void testPKFieldsBlobsDeleteByExample() {
    PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
    try {
        PkfieldsblobsWithBLOBs record = new PkfieldsblobsWithBLOBs();
        record.setId1(3);
        record.setId2(4);
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setBlob1(generateRandomBlob());
        dao.insert(record);
        record = new PkfieldsblobsWithBLOBs();
        record.setId1(5);
        record.setId2(6);
        record.setFirstname("Scott");
        record.setLastname("Jones");
        record.setBlob1(generateRandomBlob());
        dao.insert(record);
        PkfieldsblobsExample example = new PkfieldsblobsExample();
        List<Pkfieldsblobs> answer = dao.selectByExampleWithoutBLOBs(example);
        assertEquals(2, answer.size());
        example = new PkfieldsblobsExample();
        example.createCriteria().andId1NotEqualTo(3);
        int rows = dao.deleteByExample(example);
        assertEquals(1, rows);
        example = new PkfieldsblobsExample();
        answer = dao.selectByExampleWithoutBLOBs(example);
        assertEquals(1, answer.size());
    } catch (Exception e) {
        fail(e.getMessage());
    }
}
Also used : Pkfieldsblobs(mbg.test.ib2j5.generated.hierarchical.model.Pkfieldsblobs) PkfieldsblobsExample(mbg.test.ib2j5.generated.hierarchical.model.PkfieldsblobsExample) PkfieldsblobsWithBLOBs(mbg.test.ib2j5.generated.hierarchical.model.PkfieldsblobsWithBLOBs) PkfieldsblobsDAO(mbg.test.ib2j5.generated.hierarchical.dao.PkfieldsblobsDAO) Test(org.junit.Test)

Example 44 with Pkfieldsblobs

use of mbg.test.mb3.generated.hierarchical.model.Pkfieldsblobs in project generator by mybatis.

the class HierarchicalJava5Test method testPKFieldsBlobsDeleteByPrimaryKey.

@Test
public void testPKFieldsBlobsDeleteByPrimaryKey() {
    PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
    try {
        PkfieldsblobsWithBLOBs record = new PkfieldsblobsWithBLOBs();
        record.setId1(3);
        record.setId2(4);
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setBlob1(generateRandomBlob());
        dao.insert(record);
        record = new PkfieldsblobsWithBLOBs();
        record.setId1(5);
        record.setId2(6);
        record.setFirstname("Scott");
        record.setLastname("Jones");
        record.setBlob1(generateRandomBlob());
        dao.insert(record);
        PkfieldsblobsExample example = new PkfieldsblobsExample();
        List<Pkfieldsblobs> answer = dao.selectByExampleWithoutBLOBs(example);
        assertEquals(2, answer.size());
        PkfieldsblobsKey key = new PkfieldsblobsKey();
        key.setId1(5);
        key.setId2(6);
        int rows = dao.deleteByPrimaryKey(key);
        assertEquals(1, rows);
        example = new PkfieldsblobsExample();
        answer = dao.selectByExampleWithoutBLOBs(example);
        assertEquals(1, answer.size());
    } catch (Exception e) {
        fail(e.getMessage());
    }
}
Also used : Pkfieldsblobs(mbg.test.ib2j5.generated.hierarchical.model.Pkfieldsblobs) PkfieldsblobsKey(mbg.test.ib2j5.generated.hierarchical.model.PkfieldsblobsKey) PkfieldsblobsExample(mbg.test.ib2j5.generated.hierarchical.model.PkfieldsblobsExample) PkfieldsblobsWithBLOBs(mbg.test.ib2j5.generated.hierarchical.model.PkfieldsblobsWithBLOBs) PkfieldsblobsDAO(mbg.test.ib2j5.generated.hierarchical.dao.PkfieldsblobsDAO) Test(org.junit.Test)

Example 45 with Pkfieldsblobs

use of mbg.test.mb3.generated.hierarchical.model.Pkfieldsblobs in project generator by mybatis.

the class HierarchicalJava5Test method testPKFieldsBlobsUpdateByPrimaryKeyWithoutBLOBs.

@Test
public void testPKFieldsBlobsUpdateByPrimaryKeyWithoutBLOBs() {
    PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
    try {
        PkfieldsblobsWithBLOBs record = new PkfieldsblobsWithBLOBs();
        record.setId1(3);
        record.setId2(4);
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setBlob1(generateRandomBlob());
        dao.insert(record);
        Pkfieldsblobs updateRecord = new Pkfieldsblobs();
        updateRecord.setId1(3);
        updateRecord.setId2(4);
        updateRecord.setFirstname("Scott");
        updateRecord.setLastname("Jones");
        int rows = dao.updateByPrimaryKey(updateRecord);
        assertEquals(1, rows);
        PkfieldsblobsKey key = new PkfieldsblobsKey();
        key.setId1(3);
        key.setId2(4);
        PkfieldsblobsWithBLOBs newRecord = dao.selectByPrimaryKey(key);
        assertEquals(updateRecord.getFirstname(), newRecord.getFirstname());
        assertEquals(updateRecord.getLastname(), newRecord.getLastname());
        assertEquals(record.getId1(), newRecord.getId1());
        assertEquals(record.getId2(), newRecord.getId2());
        assertTrue(blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
    } catch (Exception e) {
        fail(e.getMessage());
    }
}
Also used : Pkfieldsblobs(mbg.test.ib2j5.generated.hierarchical.model.Pkfieldsblobs) PkfieldsblobsKey(mbg.test.ib2j5.generated.hierarchical.model.PkfieldsblobsKey) PkfieldsblobsWithBLOBs(mbg.test.ib2j5.generated.hierarchical.model.PkfieldsblobsWithBLOBs) PkfieldsblobsDAO(mbg.test.ib2j5.generated.hierarchical.dao.PkfieldsblobsDAO) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)128 SqlSession (org.apache.ibatis.session.SqlSession)122 PkfieldsblobsMapper (mbg.test.mb3.generated.annotated.conditional.mapper.PkfieldsblobsMapper)14 Pkfieldsblobs (mbg.test.mb3.generated.annotated.conditional.model.Pkfieldsblobs)14 PkfieldsblobsMapper (mbg.test.mb3.generated.annotated.flat.mapper.PkfieldsblobsMapper)14 Pkfieldsblobs (mbg.test.mb3.generated.annotated.flat.model.Pkfieldsblobs)14 PkfieldsblobsMapper (mbg.test.mb3.generated.conditional.mapper.PkfieldsblobsMapper)14 Pkfieldsblobs (mbg.test.mb3.generated.conditional.model.Pkfieldsblobs)14 PkfieldsblobsMapper (mbg.test.mb3.generated.flat.mapper.PkfieldsblobsMapper)14 Pkfieldsblobs (mbg.test.mb3.generated.flat.model.Pkfieldsblobs)14 PkfieldsblobsMapper (mbg.test.mb3.generated.mixed.conditional.mapper.PkfieldsblobsMapper)14 Pkfieldsblobs (mbg.test.mb3.generated.mixed.conditional.model.Pkfieldsblobs)14 PkfieldsblobsMapper (mbg.test.mb3.generated.mixed.flat.mapper.PkfieldsblobsMapper)14 Pkfieldsblobs (mbg.test.mb3.generated.mixed.flat.model.Pkfieldsblobs)14 PkfieldsblobsExample (mbg.test.mb3.generated.annotated.conditional.model.PkfieldsblobsExample)11 PkfieldsblobsExample (mbg.test.mb3.generated.annotated.flat.model.PkfieldsblobsExample)11 PkfieldsblobsExample (mbg.test.mb3.generated.conditional.model.PkfieldsblobsExample)11 PkfieldsblobsExample (mbg.test.mb3.generated.flat.model.PkfieldsblobsExample)11 PkfieldsblobsExample (mbg.test.mb3.generated.mixed.conditional.model.PkfieldsblobsExample)11 PkfieldsblobsExample (mbg.test.mb3.generated.mixed.flat.model.PkfieldsblobsExample)11