Search in sources :

Example 1 with Pkfieldsblobs

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

the class ConditionalJava5Test method testPKFieldsBlobsSelectByExampleWithoutBlobs.

@Test
public void testPKFieldsBlobsSelectByExampleWithoutBlobs() {
    PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
    try {
        Pkfieldsblobs record = new Pkfieldsblobs();
        record.setId1(3);
        record.setId2(4);
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setBlob1(generateRandomBlob());
        dao.insert(record);
        record = new Pkfieldsblobs();
        record.setId1(5);
        record.setId2(6);
        record.setFirstname("Scott");
        record.setLastname("Jones");
        record.setBlob1(generateRandomBlob());
        dao.insert(record);
        PkfieldsblobsExample example = new PkfieldsblobsExample();
        example.createCriteria().andId2EqualTo(6);
        List<Pkfieldsblobs> answer = dao.selectByExampleWithoutBLOBs(example);
        assertEquals(1, answer.size());
        Pkfieldsblobs newRecord = answer.get(0);
        assertEquals(record.getId1(), newRecord.getId1());
        assertEquals(record.getId2(), newRecord.getId2());
        assertEquals(record.getFirstname(), newRecord.getFirstname());
        assertEquals(record.getLastname(), newRecord.getLastname());
        assertNull(newRecord.getBlob1());
    } catch (SQLException e) {
        fail(e.getMessage());
    }
}
Also used : Pkfieldsblobs(mbg.test.ib2j5.generated.conditional.model.Pkfieldsblobs) SQLException(java.sql.SQLException) PkfieldsblobsExample(mbg.test.ib2j5.generated.conditional.model.PkfieldsblobsExample) PkfieldsblobsDAO(mbg.test.ib2j5.generated.conditional.dao.PkfieldsblobsDAO) Test(org.junit.Test)

Example 2 with Pkfieldsblobs

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

the class ConditionalJava5Test method testPKFieldsBlobsSelectByExampleWithBlobs.

@Test
public void testPKFieldsBlobsSelectByExampleWithBlobs() {
    PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
    try {
        Pkfieldsblobs record = new Pkfieldsblobs();
        record.setId1(3);
        record.setId2(4);
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setBlob1(generateRandomBlob());
        dao.insert(record);
        record = new Pkfieldsblobs();
        record.setId1(5);
        record.setId2(6);
        record.setFirstname("Scott");
        record.setLastname("Jones");
        record.setBlob1(generateRandomBlob());
        dao.insert(record);
        PkfieldsblobsExample example = new PkfieldsblobsExample();
        example.createCriteria().andId2EqualTo(6);
        List<Pkfieldsblobs> answer = dao.selectByExampleWithBLOBs(example);
        assertEquals(1, answer.size());
        Pkfieldsblobs newRecord = answer.get(0);
        assertEquals(record.getId1(), newRecord.getId1());
        assertEquals(record.getId2(), newRecord.getId2());
        assertEquals(record.getFirstname(), newRecord.getFirstname());
        assertEquals(record.getLastname(), newRecord.getLastname());
        assertTrue(blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
    } catch (SQLException e) {
        fail(e.getMessage());
    }
}
Also used : Pkfieldsblobs(mbg.test.ib2j5.generated.conditional.model.Pkfieldsblobs) SQLException(java.sql.SQLException) PkfieldsblobsExample(mbg.test.ib2j5.generated.conditional.model.PkfieldsblobsExample) PkfieldsblobsDAO(mbg.test.ib2j5.generated.conditional.dao.PkfieldsblobsDAO) Test(org.junit.Test)

Example 3 with Pkfieldsblobs

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

the class ConditionalJava5Test method testPKFieldsBlobsSelectByPrimaryKey.

@Test
public void testPKFieldsBlobsSelectByPrimaryKey() {
    PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
    try {
        Pkfieldsblobs record = new Pkfieldsblobs();
        record.setId1(3);
        record.setId2(4);
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setBlob1(generateRandomBlob());
        dao.insert(record);
        record = new Pkfieldsblobs();
        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);
        Pkfieldsblobs newRecord = dao.selectByPrimaryKey(key);
        assertEquals(record.getId1(), newRecord.getId1());
        assertEquals(record.getId2(), newRecord.getId2());
        assertEquals(record.getFirstname(), newRecord.getFirstname());
        assertEquals(record.getLastname(), newRecord.getLastname());
        assertTrue(blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
    } catch (SQLException e) {
        fail(e.getMessage());
    }
}
Also used : Pkfieldsblobs(mbg.test.ib2j5.generated.conditional.model.Pkfieldsblobs) PkfieldsblobsKey(mbg.test.ib2j5.generated.conditional.model.PkfieldsblobsKey) SQLException(java.sql.SQLException) PkfieldsblobsExample(mbg.test.ib2j5.generated.conditional.model.PkfieldsblobsExample) PkfieldsblobsDAO(mbg.test.ib2j5.generated.conditional.dao.PkfieldsblobsDAO) Test(org.junit.Test)

Example 4 with Pkfieldsblobs

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

the class ConditionalJava5Test method testPKFieldsBlobsDeleteByExample.

@Test
public void testPKFieldsBlobsDeleteByExample() {
    PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
    try {
        Pkfieldsblobs record = new Pkfieldsblobs();
        record.setId1(3);
        record.setId2(4);
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setBlob1(generateRandomBlob());
        dao.insert(record);
        record = new Pkfieldsblobs();
        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 (SQLException e) {
        fail(e.getMessage());
    }
}
Also used : Pkfieldsblobs(mbg.test.ib2j5.generated.conditional.model.Pkfieldsblobs) SQLException(java.sql.SQLException) PkfieldsblobsExample(mbg.test.ib2j5.generated.conditional.model.PkfieldsblobsExample) PkfieldsblobsDAO(mbg.test.ib2j5.generated.conditional.dao.PkfieldsblobsDAO) Test(org.junit.Test)

Example 5 with Pkfieldsblobs

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

the class UpdateByExampleTest method testPKFieldsBlobsUpdateByExampleSelective.

@Test
public void testPKFieldsBlobsUpdateByExampleSelective() {
    PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
    try {
        Pkfieldsblobs record = new Pkfieldsblobs();
        record.setId1(3);
        record.setId2(4);
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setBlob1(generateRandomBlob());
        dao.insert(record);
        record = new Pkfieldsblobs();
        record.setId1(5);
        record.setId2(6);
        record.setFirstname("Scott");
        record.setLastname("Jones");
        record.setBlob1(generateRandomBlob());
        dao.insert(record);
        Pkfieldsblobs newRecord = new Pkfieldsblobs();
        newRecord.setFirstname("Fred");
        PkfieldsblobsExample example = new PkfieldsblobsExample();
        example.createCriteria().andId1NotEqualTo(3);
        int rows = dao.updateByExampleSelective(newRecord, example);
        assertEquals(1, rows);
        List<Pkfieldsblobs> answer = dao.selectByExampleWithBLOBs(example);
        assertEquals(1, answer.size());
        Pkfieldsblobs returnedRecord = answer.get(0);
        assertEquals(record.getId1(), returnedRecord.getId1());
        assertEquals(record.getId2(), returnedRecord.getId2());
        assertEquals(newRecord.getFirstname(), returnedRecord.getFirstname());
        assertEquals(record.getLastname(), returnedRecord.getLastname());
        assertTrue(blobsAreEqual(record.getBlob1(), returnedRecord.getBlob1()));
    } catch (SQLException e) {
        fail(e.getMessage());
    }
}
Also used : Pkfieldsblobs(mbg.test.ib2j5.generated.conditional.model.Pkfieldsblobs) SQLException(java.sql.SQLException) PkfieldsblobsExample(mbg.test.ib2j5.generated.conditional.model.PkfieldsblobsExample) PkfieldsblobsDAO(mbg.test.ib2j5.generated.conditional.dao.PkfieldsblobsDAO) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)136 SqlSession (org.apache.ibatis.session.SqlSession)122 SQLException (java.sql.SQLException)14 PkfieldsblobsDAO (mbg.test.ib2j2.generated.conditional.dao.PkfieldsblobsDAO)14 Pkfieldsblobs (mbg.test.ib2j2.generated.conditional.model.Pkfieldsblobs)14 PkfieldsblobsDAO (mbg.test.ib2j5.generated.conditional.dao.PkfieldsblobsDAO)14 Pkfieldsblobs (mbg.test.ib2j5.generated.conditional.model.Pkfieldsblobs)14 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 PkfieldsblobsExample (mbg.test.ib2j2.generated.conditional.model.PkfieldsblobsExample)11 PkfieldsblobsExample (mbg.test.ib2j5.generated.conditional.model.PkfieldsblobsExample)11 PkfieldsblobsExample (mbg.test.mb3.generated.annotated.conditional.model.PkfieldsblobsExample)11