Package mbg.test.mb3.generated.annotated.conditional.model

Examples of mbg.test.mb3.generated.annotated.conditional.model.FieldsonlyExample


            record.setDoublefield(11.22);
            record.setFloatfield(33.44);
            record.setIntegerfield(5);
            mapper.insert(record);

            FieldsonlyExample example = new FieldsonlyExample();
            example.createCriteria().andIntegerfieldEqualTo(5);

            List<Fieldsonly> answer = mapper.selectByExample(example);
            assertEquals(1, answer.size());

            Fieldsonly returnedRecord = answer.get(0);
View Full Code Here


            record.setDoublefield(88.99);
            record.setFloatfield(100.111);
            record.setIntegerfield(9);
            mapper.insert(record);

            FieldsonlyExample example = new FieldsonlyExample();
            example.createCriteria().andIntegerfieldGreaterThan(5);

            List<Fieldsonly> answer = mapper.selectByExample(example);
            assertEquals(2, answer.size());

            example = new FieldsonlyExample();
            answer = mapper.selectByExample(example);
            assertEquals(3, answer.size());
        } finally {
            sqlSession.close();
        }
View Full Code Here

            record.setDoublefield(88.99);
            record.setFloatfield(100.111);
            record.setIntegerfield(9);
            mapper.insert(record);

            FieldsonlyExample example = new FieldsonlyExample();
            example.createCriteria();

            List<Fieldsonly> answer = mapper.selectByExample(example);
            assertEquals(3, answer.size());
        } finally {
            sqlSession.close();
View Full Code Here

            record.setDoublefield(88.99);
            record.setFloatfield(100.111);
            record.setIntegerfield(9);
            mapper.insert(record);

            FieldsonlyExample example = new FieldsonlyExample();
            example.createCriteria().andIntegerfieldGreaterThan(5);

            int rows = mapper.deleteByExample(example);
            assertEquals(2, rows);

            example = new FieldsonlyExample();
            List<Fieldsonly> answer = mapper.selectByExample(example);
            assertEquals(1, answer.size());
        } finally {
            sqlSession.close();
        }
View Full Code Here

            record.setDoublefield(88.99);
            record.setFloatfield(100.111);
            record.setIntegerfield(9);
            mapper.insert(record);

            FieldsonlyExample example = new FieldsonlyExample();
            example.createCriteria().andIntegerfieldGreaterThan(5);
            int rows = mapper.countByExample(example);
            assertEquals(2, rows);

            example.clear();
            rows = mapper.countByExample(example);
            assertEquals(3, rows);
        } finally {
            sqlSession.close();
        }
View Full Code Here

            record.setIntegerfield(9);
            mapper.insert(record);

            record = new Fieldsonly();
            record.setDoublefield(99d);
            FieldsonlyExample example = new FieldsonlyExample();
            example.createCriteria().andIntegerfieldGreaterThan(5);
           
            int rows = mapper.updateByExampleSelective(record, example);
            assertEquals(2, rows);

            example.clear();
            example.createCriteria().andIntegerfieldEqualTo(5);
            List<Fieldsonly> answer = mapper.selectByExample(example);
            assertEquals(1, answer.size());
            record = answer.get(0);
            assertEquals(record.getDoublefield(), 11.22, 0.0);
            assertEquals(record.getFloatfield(), 33.44, 0.0);
            assertEquals(record.getIntegerfield().intValue(), 5);
           
            example.clear();
            example.createCriteria().andIntegerfieldEqualTo(8);
            answer = mapper.selectByExample(example);
            assertEquals(1, answer.size());
            record = answer.get(0);
            assertEquals(record.getDoublefield(), 99d, 0.0);
            assertEquals(record.getFloatfield(), 66.77, 0.0);
            assertEquals(record.getIntegerfield().intValue(), 8);
           
            example.clear();
            example.createCriteria().andIntegerfieldEqualTo(9);
            answer = mapper.selectByExample(example);
            assertEquals(1, answer.size());
            record = answer.get(0);
            assertEquals(record.getDoublefield(), 99d, 0.0);
            assertEquals(record.getFloatfield(), 100.111, 0.0);
View Full Code Here

            record.setIntegerfield(9);
            mapper.insert(record);

            record = new Fieldsonly();
            record.setIntegerfield(22);
            FieldsonlyExample example = new FieldsonlyExample();
            example.createCriteria().andIntegerfieldEqualTo(5);
           
            int rows = mapper.updateByExample(record, example);
            assertEquals(1, rows);

            example.clear();
            example.createCriteria().andIntegerfieldEqualTo(22);
            List<Fieldsonly> answer = mapper.selectByExample(example);
            assertEquals(1, answer.size());
            record = answer.get(0);
            assertNull(record.getDoublefield());
            assertNull(record.getFloatfield());
View Full Code Here

        calendar.set(Calendar.MINUTE, 10);
        calendar.set(Calendar.SECOND, 10);

        try {
            PkfieldsMapper mapper = sqlSession.getMapper(PkfieldsMapper.class);
            Pkfields record = new Pkfields();
            record.setId1(1);
            record.setId2(1);
            record.setDatefield(calendar.getTime());
            record.setTimefield(calendar.getTime());
            mapper.insert(record);

            record = new Pkfields();
            record.setId1(1);
            record.setId2(2);
            calendar.set(Calendar.DAY_OF_MONTH, 16);
            calendar.set(Calendar.MINUTE, 11);
            record.setDatefield(calendar.getTime());
            record.setTimefield(calendar.getTime());
            mapper.insert(record);

            record = new Pkfields();
            record.setId1(1);
            record.setId2(3);
            calendar.set(Calendar.DAY_OF_MONTH, 17);
            calendar.set(Calendar.MINUTE, 12);
            record.setDatefield(calendar.getTime());
            record.setTimefield(calendar.getTime());
            mapper.insert(record);

            record = new Pkfields();
            record.setId1(2);
            record.setId2(1);
            calendar.set(Calendar.DAY_OF_MONTH, 18);
            calendar.set(Calendar.MINUTE, 13);
            record.setDatefield(calendar.getTime());
            record.setTimefield(calendar.getTime());
            mapper.insert(record);

            record = new Pkfields();
            record.setId1(2);
            record.setId2(2);
            calendar.set(Calendar.DAY_OF_MONTH, 19);
            calendar.set(Calendar.MINUTE, 14);
            record.setDatefield(calendar.getTime());
            record.setTimefield(calendar.getTime());
            mapper.insert(record);

            record = new Pkfields();
            record.setId1(2);
            record.setId2(3);
            calendar.set(Calendar.DAY_OF_MONTH, 20);
            calendar.set(Calendar.MINUTE, 15);
            record.setDatefield(calendar.getTime());
            record.setTimefield(calendar.getTime());
            mapper.insert(record);

            PkfieldsExample example = new PkfieldsExample();
            example.createCriteria().andDatefieldEqualTo(calendar.getTime());
View Full Code Here

    public void testPKFieldsCountByExample() {
        SqlSession sqlSession = sqlSessionFactory.openSession();

        try {
            PkfieldsMapper mapper = sqlSession.getMapper(PkfieldsMapper.class);
            Pkfields record = new Pkfields();
            record.setFirstname("Jeff");
            record.setLastname("Smith");
            record.setId1(1);
            record.setId2(2);
            mapper.insert(record);

            record = new Pkfields();
            record.setFirstname("Bob");
            record.setLastname("Jones");
            record.setId1(3);
            record.setId2(4);
            mapper.insert(record);

            PkfieldsExample example = new PkfieldsExample();
            example.createCriteria().andLastnameLike("J%");
            int rows = mapper.countByExample(example);
View Full Code Here

    public void testPKFieldsSelectByExampleIn() {
        SqlSession sqlSession = sqlSessionFactory.openSession();

        try {
            PkfieldsMapper mapper = sqlSession.getMapper(PkfieldsMapper.class);
            Pkfields record = new Pkfields();
            record.setFirstname("Fred");
            record.setLastname("Flintstone");
            record.setId1(1);
            record.setId2(1);
            mapper.insert(record);

            record = new Pkfields();
            record.setFirstname("Wilma");
            record.setLastname("Flintstone");
            record.setId1(1);
            record.setId2(2);
            mapper.insert(record);

            record = new Pkfields();
            record.setFirstname("Pebbles");
            record.setLastname("Flintstone");
            record.setId1(1);
            record.setId2(3);
            mapper.insert(record);

            record = new Pkfields();
            record.setFirstname("Barney");
            record.setLastname("Rubble");
            record.setId1(2);
            record.setId2(1);
            mapper.insert(record);

            record = new Pkfields();
            record.setFirstname("Betty");
            record.setLastname("Rubble");
            record.setId1(2);
            record.setId2(2);
            mapper.insert(record);

            record = new Pkfields();
            record.setFirstname("Bamm Bamm");
            record.setLastname("Rubble");
            record.setId1(2);
            record.setId2(3);
            mapper.insert(record);

            List<Integer> ids = new ArrayList<Integer>();
            ids.add(1);
            ids.add(3);

            PkfieldsExample example = new PkfieldsExample();
            example.createCriteria().andId2In(ids);

            example.setOrderByClause("ID1, ID2");
            List<Pkfields> answer = mapper.selectByExample(example);
            assertEquals(4, answer.size());
            Pkfields returnedRecord = answer.get(0);
            assertEquals(1, returnedRecord.getId1().intValue());
            assertEquals(1, returnedRecord.getId2().intValue());
            returnedRecord = answer.get(1);
            assertEquals(1, returnedRecord.getId1().intValue());
            assertEquals(3, returnedRecord.getId2().intValue());
            returnedRecord = answer.get(2);
            assertEquals(2, returnedRecord.getId1().intValue());
            assertEquals(1, returnedRecord.getId2().intValue());
            returnedRecord = answer.get(3);
            assertEquals(2, returnedRecord.getId1().intValue());
            assertEquals(3, returnedRecord.getId2().intValue());
        } finally {
            sqlSession.close();
        }
    }
View Full Code Here

TOP

Related Classes of mbg.test.mb3.generated.annotated.conditional.model.FieldsonlyExample

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.