Search in sources :

Example 46 with Id

use of mbg.test.mb3.generated.dsql.model.mbgtest.Id in project generator by mybatis.

the class ConditionalJava5Test method testAwfulTableSelectByExampleNotLike.

@Test
public void testAwfulTableSelectByExampleNotLike() {
    SqlSession sqlSession = sqlSessionFactory.openSession();
    try {
        AwfulTableMapper mapper = sqlSession.getMapper(AwfulTableMapper.class);
        AwfulTable record = new AwfulTable();
        record.seteMail("fred@fred.com");
        record.setEmailaddress("alsofred@fred.com");
        record.setFirstFirstName("fred1");
        record.setFrom("from field");
        record.setId1(1);
        record.setId2(2);
        record.setId5(5);
        record.setId6(6);
        record.setId7(7);
        record.setSecondFirstName("fred2");
        record.setThirdFirstName("fred3");
        mapper.insert(record);
        record = new AwfulTable();
        record.seteMail("wilma@wilma.com");
        record.setEmailaddress("alsoWilma@wilma.com");
        record.setFirstFirstName("wilma1");
        record.setFrom("from field");
        record.setId1(11);
        record.setId2(22);
        record.setId5(55);
        record.setId6(66);
        record.setId7(77);
        record.setSecondFirstName("wilma2");
        record.setThirdFirstName("wilma3");
        mapper.insert(record);
        record = new AwfulTable();
        record.seteMail("pebbles@pebbles.com");
        record.setEmailaddress("alsoPebbles@pebbles.com");
        record.setFirstFirstName("pebbles1");
        record.setFrom("from field");
        record.setId1(111);
        record.setId2(222);
        record.setId5(555);
        record.setId6(666);
        record.setId7(777);
        record.setSecondFirstName("pebbles2");
        record.setThirdFirstName("pebbles3");
        mapper.insert(record);
        record = new AwfulTable();
        record.seteMail("barney@barney.com");
        record.setEmailaddress("alsoBarney@barney.com");
        record.setFirstFirstName("barney1");
        record.setFrom("from field");
        record.setId1(1111);
        record.setId2(2222);
        record.setId5(5555);
        record.setId6(6666);
        record.setId7(7777);
        record.setSecondFirstName("barney2");
        record.setThirdFirstName("barney3");
        mapper.insert(record);
        record = new AwfulTable();
        record.seteMail("betty@betty.com");
        record.setEmailaddress("alsoBetty@betty.com");
        record.setFirstFirstName("betty1");
        record.setFrom("from field");
        record.setId1(11111);
        record.setId2(22222);
        record.setId5(55555);
        record.setId6(66666);
        record.setId7(77777);
        record.setSecondFirstName("betty2");
        record.setThirdFirstName("betty3");
        mapper.insert(record);
        record = new AwfulTable();
        record.seteMail("bammbamm@bammbamm.com");
        record.setEmailaddress("alsoBammbamm@bammbamm.com");
        record.setFirstFirstName("bammbamm1");
        record.setFrom("from field");
        record.setId1(111111);
        record.setId2(222222);
        record.setId5(555555);
        record.setId6(666666);
        record.setId7(777777);
        record.setSecondFirstName("bammbamm2");
        record.setThirdFirstName("bammbamm3");
        mapper.insert(record);
        AwfulTableExample example = new AwfulTableExample();
        example.createCriteria().andFirstFirstNameNotLike("b%");
        example.setOrderByClause("\"A_CuStOmEr iD\"");
        List<AwfulTable> answer = mapper.selectByExample(example);
        assertEquals(3, answer.size());
        AwfulTable returnedRecord = answer.get(0);
        assertEquals(1, returnedRecord.getId1().intValue());
        assertEquals(2, returnedRecord.getId2().intValue());
        returnedRecord = answer.get(1);
        assertEquals(11, returnedRecord.getId1().intValue());
        assertEquals(22, returnedRecord.getId2().intValue());
        returnedRecord = answer.get(2);
        assertEquals(111, returnedRecord.getId1().intValue());
        assertEquals(222, returnedRecord.getId2().intValue());
    } finally {
        sqlSession.close();
    }
}
Also used : AwfulTableExample(mbg.test.mb3.generated.conditional.model.AwfulTableExample) SqlSession(org.apache.ibatis.session.SqlSession) AwfulTableMapper(mbg.test.mb3.generated.conditional.mapper.AwfulTableMapper) AwfulTable(mbg.test.mb3.generated.conditional.model.AwfulTable) Test(org.junit.jupiter.api.Test)

Example 47 with Id

use of mbg.test.mb3.generated.dsql.model.mbgtest.Id in project generator by mybatis.

the class HierarchicalJava5Test method testAwfulTableSelectByExampleNotLike.

@Test
public void testAwfulTableSelectByExampleNotLike() {
    SqlSession sqlSession = sqlSessionFactory.openSession();
    try {
        AwfulTableMapper mapper = sqlSession.getMapper(AwfulTableMapper.class);
        AwfulTable record = new AwfulTable();
        record.seteMail("fred@fred.com");
        record.setEmailaddress("alsofred@fred.com");
        record.setFirstFirstName("fred1");
        record.setFrom("from field");
        record.setId1(1);
        record.setId2(2);
        record.setId5(5);
        record.setId6(6);
        record.setId7(7);
        record.setSecondFirstName("fred2");
        record.setThirdFirstName("fred3");
        mapper.insert(record);
        record = new AwfulTable();
        record.seteMail("wilma@wilma.com");
        record.setEmailaddress("alsoWilma@wilma.com");
        record.setFirstFirstName("wilma1");
        record.setFrom("from field");
        record.setId1(11);
        record.setId2(22);
        record.setId5(55);
        record.setId6(66);
        record.setId7(77);
        record.setSecondFirstName("wilma2");
        record.setThirdFirstName("wilma3");
        mapper.insert(record);
        record = new AwfulTable();
        record.seteMail("pebbles@pebbles.com");
        record.setEmailaddress("alsoPebbles@pebbles.com");
        record.setFirstFirstName("pebbles1");
        record.setFrom("from field");
        record.setId1(111);
        record.setId2(222);
        record.setId5(555);
        record.setId6(666);
        record.setId7(777);
        record.setSecondFirstName("pebbles2");
        record.setThirdFirstName("pebbles3");
        mapper.insert(record);
        record = new AwfulTable();
        record.seteMail("barney@barney.com");
        record.setEmailaddress("alsoBarney@barney.com");
        record.setFirstFirstName("barney1");
        record.setFrom("from field");
        record.setId1(1111);
        record.setId2(2222);
        record.setId5(5555);
        record.setId6(6666);
        record.setId7(7777);
        record.setSecondFirstName("barney2");
        record.setThirdFirstName("barney3");
        mapper.insert(record);
        record = new AwfulTable();
        record.seteMail("betty@betty.com");
        record.setEmailaddress("alsoBetty@betty.com");
        record.setFirstFirstName("betty1");
        record.setFrom("from field");
        record.setId1(11111);
        record.setId2(22222);
        record.setId5(55555);
        record.setId6(66666);
        record.setId7(77777);
        record.setSecondFirstName("betty2");
        record.setThirdFirstName("betty3");
        mapper.insert(record);
        record = new AwfulTable();
        record.seteMail("bammbamm@bammbamm.com");
        record.setEmailaddress("alsoBammbamm@bammbamm.com");
        record.setFirstFirstName("bammbamm1");
        record.setFrom("from field");
        record.setId1(111111);
        record.setId2(222222);
        record.setId5(555555);
        record.setId6(666666);
        record.setId7(777777);
        record.setSecondFirstName("bammbamm2");
        record.setThirdFirstName("bammbamm3");
        mapper.insert(record);
        AwfulTableExample example = new AwfulTableExample();
        example.createCriteria().andFirstFirstNameNotLike("b%");
        example.setOrderByClause("\"A_CuStOmEr iD\"");
        List<AwfulTable> answer = mapper.selectByExample(example);
        assertEquals(3, answer.size());
        AwfulTable returnedRecord = answer.get(0);
        assertEquals(1, returnedRecord.getId1().intValue());
        assertEquals(2, returnedRecord.getId2().intValue());
        returnedRecord = answer.get(1);
        assertEquals(11, returnedRecord.getId1().intValue());
        assertEquals(22, returnedRecord.getId2().intValue());
        returnedRecord = answer.get(2);
        assertEquals(111, returnedRecord.getId1().intValue());
        assertEquals(222, returnedRecord.getId2().intValue());
    } finally {
        sqlSession.close();
    }
}
Also used : AwfulTableExample(mbg.test.mb3.generated.annotated.hierarchical.model.AwfulTableExample) SqlSession(org.apache.ibatis.session.SqlSession) AwfulTableMapper(mbg.test.mb3.generated.annotated.hierarchical.mapper.AwfulTableMapper) AwfulTable(mbg.test.mb3.generated.annotated.hierarchical.model.AwfulTable) Test(org.junit.jupiter.api.Test)

Aggregations

SqlSession (org.apache.ibatis.session.SqlSession)47 Test (org.junit.jupiter.api.Test)47 ArrayList (java.util.ArrayList)9 AwfulTableMapper (mbg.test.mb3.generated.annotated.conditional.mapper.AwfulTableMapper)5 AwfulTable (mbg.test.mb3.generated.annotated.conditional.model.AwfulTable)5 AwfulTableExample (mbg.test.mb3.generated.annotated.conditional.model.AwfulTableExample)5 AwfulTableMapper (mbg.test.mb3.generated.annotated.flat.mapper.AwfulTableMapper)5 AwfulTable (mbg.test.mb3.generated.annotated.flat.model.AwfulTable)5 AwfulTableExample (mbg.test.mb3.generated.annotated.flat.model.AwfulTableExample)5 AwfulTableMapper (mbg.test.mb3.generated.annotated.hierarchical.mapper.AwfulTableMapper)5 AwfulTable (mbg.test.mb3.generated.annotated.hierarchical.model.AwfulTable)5 AwfulTableExample (mbg.test.mb3.generated.annotated.hierarchical.model.AwfulTableExample)5 AwfulTableMapper (mbg.test.mb3.generated.conditional.mapper.AwfulTableMapper)5 AwfulTable (mbg.test.mb3.generated.conditional.model.AwfulTable)5 AwfulTableExample (mbg.test.mb3.generated.conditional.model.AwfulTableExample)5 AwfulTableMapper (mbg.test.mb3.generated.flat.mapper.AwfulTableMapper)5 AwfulTable (mbg.test.mb3.generated.flat.model.AwfulTable)5 AwfulTableExample (mbg.test.mb3.generated.flat.model.AwfulTableExample)5 AwfulTableMapper (mbg.test.mb3.generated.hierarchical.mapper.AwfulTableMapper)5 AwfulTable (mbg.test.mb3.generated.hierarchical.model.AwfulTable)5