Search in sources :

Example 1 with FieldsblobsExample

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

the class ConditionalJava5Test method testFieldsBlobsSelectByExampleWithBlobsNoCriteria.

@Test
public void testFieldsBlobsSelectByExampleWithBlobsNoCriteria() {
    FieldsblobsDAO dao = getFieldsblobsDAO();
    try {
        FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs();
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setBlob1(generateRandomBlob());
        record.setBlob2(generateRandomBlob());
        dao.insert(record);
        record = new FieldsblobsWithBLOBs();
        record.setFirstname("Scott");
        record.setLastname("Jones");
        record.setBlob1(generateRandomBlob());
        record.setBlob2(generateRandomBlob());
        dao.insert(record);
        FieldsblobsExample example = new FieldsblobsExample();
        example.createCriteria();
        List<FieldsblobsWithBLOBs> answer = dao.selectByExampleWithBLOBs(example);
        assertEquals(2, answer.size());
    } catch (SQLException e) {
        fail(e.getMessage());
    }
}
Also used : FieldsblobsWithBLOBs(mbg.test.ib2j5.generated.conditional.model.FieldsblobsWithBLOBs) FieldsblobsExample(mbg.test.ib2j5.generated.conditional.model.FieldsblobsExample) SQLException(java.sql.SQLException) FieldsblobsDAO(mbg.test.ib2j5.generated.conditional.dao.FieldsblobsDAO) Test(org.junit.Test)

Example 2 with FieldsblobsExample

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

the class ConditionalJava5Test method testFieldsBlobsSelectByExampleWithoutBlobs.

@Test
public void testFieldsBlobsSelectByExampleWithoutBlobs() {
    FieldsblobsDAO dao = getFieldsblobsDAO();
    try {
        FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs();
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setBlob1(generateRandomBlob());
        record.setBlob2(generateRandomBlob());
        dao.insert(record);
        record = new FieldsblobsWithBLOBs();
        record.setFirstname("Scott");
        record.setLastname("Jones");
        record.setBlob1(generateRandomBlob());
        record.setBlob2(generateRandomBlob());
        dao.insert(record);
        FieldsblobsExample example = new FieldsblobsExample();
        example.createCriteria().andFirstnameLike("S%");
        List<Fieldsblobs> answer = dao.selectByExampleWithoutBLOBs(example);
        assertEquals(1, answer.size());
        Fieldsblobs newRecord = answer.get(0);
        assertFalse(newRecord instanceof FieldsblobsWithBLOBs);
        assertEquals(record.getFirstname(), newRecord.getFirstname());
        assertEquals(record.getLastname(), newRecord.getLastname());
    } catch (SQLException e) {
        fail(e.getMessage());
    }
}
Also used : FieldsblobsWithBLOBs(mbg.test.ib2j5.generated.conditional.model.FieldsblobsWithBLOBs) FieldsblobsExample(mbg.test.ib2j5.generated.conditional.model.FieldsblobsExample) SQLException(java.sql.SQLException) Fieldsblobs(mbg.test.ib2j5.generated.conditional.model.Fieldsblobs) FieldsblobsDAO(mbg.test.ib2j5.generated.conditional.dao.FieldsblobsDAO) Test(org.junit.Test)

Example 3 with FieldsblobsExample

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

the class ConditionalJava5Test method testFieldsBlobsCountByExample.

@Test
public void testFieldsBlobsCountByExample() {
    FieldsblobsDAO dao = getFieldsblobsDAO();
    try {
        FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs();
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setBlob1(generateRandomBlob());
        record.setBlob2(generateRandomBlob());
        dao.insert(record);
        record = new FieldsblobsWithBLOBs();
        record.setFirstname("Scott");
        record.setLastname("Jones");
        record.setBlob1(generateRandomBlob());
        record.setBlob2(generateRandomBlob());
        dao.insert(record);
        FieldsblobsExample example = new FieldsblobsExample();
        example.createCriteria().andFirstnameLike("S%");
        long rows = dao.countByExample(example);
        assertEquals(1, rows);
        example.clear();
        rows = dao.countByExample(example);
        assertEquals(2, rows);
    } catch (SQLException e) {
        fail(e.getMessage());
    }
}
Also used : FieldsblobsWithBLOBs(mbg.test.ib2j5.generated.conditional.model.FieldsblobsWithBLOBs) FieldsblobsExample(mbg.test.ib2j5.generated.conditional.model.FieldsblobsExample) SQLException(java.sql.SQLException) FieldsblobsDAO(mbg.test.ib2j5.generated.conditional.dao.FieldsblobsDAO) Test(org.junit.Test)

Example 4 with FieldsblobsExample

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

the class ConditionalJava5Test method testFieldsBlobsDeleteByExample.

@Test
public void testFieldsBlobsDeleteByExample() {
    FieldsblobsDAO dao = getFieldsblobsDAO();
    try {
        FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs();
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setBlob1(generateRandomBlob());
        record.setBlob2(generateRandomBlob());
        dao.insert(record);
        record = new FieldsblobsWithBLOBs();
        record.setFirstname("Scott");
        record.setLastname("Jones");
        record.setBlob1(generateRandomBlob());
        record.setBlob2(generateRandomBlob());
        dao.insert(record);
        FieldsblobsExample example = new FieldsblobsExample();
        List<Fieldsblobs> answer = dao.selectByExampleWithoutBLOBs(example);
        assertEquals(2, answer.size());
        example = new FieldsblobsExample();
        example.createCriteria().andFirstnameLike("S%");
        int rows = dao.deleteByExample(example);
        assertEquals(1, rows);
        example = new FieldsblobsExample();
        answer = dao.selectByExampleWithoutBLOBs(example);
        assertEquals(1, answer.size());
    } catch (SQLException e) {
        fail(e.getMessage());
    }
}
Also used : FieldsblobsWithBLOBs(mbg.test.ib2j5.generated.conditional.model.FieldsblobsWithBLOBs) FieldsblobsExample(mbg.test.ib2j5.generated.conditional.model.FieldsblobsExample) SQLException(java.sql.SQLException) Fieldsblobs(mbg.test.ib2j5.generated.conditional.model.Fieldsblobs) FieldsblobsDAO(mbg.test.ib2j5.generated.conditional.dao.FieldsblobsDAO) Test(org.junit.Test)

Example 5 with FieldsblobsExample

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

the class UpdateByExampleTest method testFieldsBlobsUpdateByExampleWithBLOBs.

@Test
public void testFieldsBlobsUpdateByExampleWithBLOBs() {
    FieldsblobsDAO dao = getFieldsblobsDAO();
    try {
        FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs();
        record.setFirstname("Jeff");
        record.setLastname("Smith");
        record.setBlob1(generateRandomBlob());
        record.setBlob2(generateRandomBlob());
        dao.insert(record);
        record = new FieldsblobsWithBLOBs();
        record.setFirstname("Scott");
        record.setLastname("Jones");
        record.setBlob1(generateRandomBlob());
        record.setBlob2(generateRandomBlob());
        dao.insert(record);
        FieldsblobsWithBLOBs newRecord = new FieldsblobsWithBLOBs();
        newRecord.setFirstname("Scott");
        newRecord.setLastname("Doe");
        FieldsblobsExample example = new FieldsblobsExample();
        example.createCriteria().andFirstnameLike("S%");
        int rows = dao.updateByExample(newRecord, example);
        assertEquals(1, rows);
        List<FieldsblobsWithBLOBs> answer = dao.selectByExampleWithBLOBs(example);
        assertEquals(1, answer.size());
        FieldsblobsWithBLOBs returnedRecord = answer.get(0);
        assertEquals(newRecord.getFirstname(), returnedRecord.getFirstname());
        assertEquals(newRecord.getLastname(), returnedRecord.getLastname());
        assertNull(returnedRecord.getBlob1());
        assertNull(returnedRecord.getBlob2());
    } catch (SQLException e) {
        fail(e.getMessage());
    }
}
Also used : FieldsblobsWithBLOBs(mbg.test.ib2j5.generated.conditional.model.FieldsblobsWithBLOBs) FieldsblobsExample(mbg.test.ib2j5.generated.conditional.model.FieldsblobsExample) SQLException(java.sql.SQLException) FieldsblobsDAO(mbg.test.ib2j5.generated.conditional.dao.FieldsblobsDAO) Test(org.junit.Test)

Aggregations

SqlSession (org.apache.ibatis.session.SqlSession)114 Test (org.junit.jupiter.api.Test)114 SQLException (java.sql.SQLException)9 FieldsblobsDAO (mbg.test.ib2j5.generated.conditional.dao.FieldsblobsDAO)9 FieldsblobsExample (mbg.test.ib2j5.generated.conditional.model.FieldsblobsExample)9 FieldsblobsWithBLOBs (mbg.test.ib2j5.generated.conditional.model.FieldsblobsWithBLOBs)9 FieldsblobsMapper (mbg.test.mb3.generated.annotated.hierarchical.Immutable.Mapper.FieldsblobsMapper)9 FieldsblobsExample (mbg.test.mb3.generated.annotated.hierarchical.Immutable.Model.FieldsblobsExample)9 FieldsblobsWithBLOBs (mbg.test.mb3.generated.annotated.hierarchical.Immutable.Model.FieldsblobsWithBLOBs)9 FieldsblobsMapper (mbg.test.mb3.generated.annotated.hierarchical.mapper.FieldsblobsMapper)9 FieldsblobsExample (mbg.test.mb3.generated.annotated.hierarchical.model.FieldsblobsExample)9 FieldsblobsWithBLOBs (mbg.test.mb3.generated.annotated.hierarchical.model.FieldsblobsWithBLOBs)9 FieldsblobsMapper (mbg.test.mb3.generated.conditional.immutable.mapper.FieldsblobsMapper)9 FieldsblobsExample (mbg.test.mb3.generated.conditional.immutable.model.FieldsblobsExample)9 FieldsblobsWithBLOBs (mbg.test.mb3.generated.conditional.immutable.model.FieldsblobsWithBLOBs)9 FieldsblobsMapper (mbg.test.mb3.generated.conditional.mapper.FieldsblobsMapper)9 FieldsblobsExample (mbg.test.mb3.generated.conditional.model.FieldsblobsExample)9 FieldsblobsWithBLOBs (mbg.test.mb3.generated.conditional.model.FieldsblobsWithBLOBs)9 FieldsblobsMapper (mbg.test.mb3.generated.hierarchical.immutable.mapper.FieldsblobsMapper)9 FieldsblobsExample (mbg.test.mb3.generated.hierarchical.immutable.model.FieldsblobsExample)9