Examples of JPAQueryParser


Examples of com.spaceprogram.simplejpa.query.JPAQueryParser

*/
public class QueryTests {
    @Test
    public void testWhere(){
        JPAQuery query = new JPAQuery();
        JPAQueryParser parser;
        List<String> split;

        parser = new JPAQueryParser(query, ("select o from MyTestObject o where o.myTestObject2.id = :id2 and 1=1 OR o.myTestObject2.name = 'larry'"));
        parser.parse();
        split = QueryImpl.tokenizeWhere(query.getFilter());
        Assert.assertEquals(11, split.size());
        Assert.assertEquals("o.myTestObject2.id = :id2 and 1 = 1 OR o.myTestObject2.name = 'larry' ", toString(split));
    }
View Full Code Here

Examples of com.spaceprogram.simplejpa.query.JPAQueryParser

    @Test
    public void testDates(){
        String q = "select o from MyTestObject o where o.birthday > :from and o.birthday < :to and o.id = :id";
        JPAQuery query = new JPAQuery();
        JPAQueryParser parser;
        List<String> split;

        parser = new JPAQueryParser(query, (q));
        parser.parse();
        split = QueryImpl.tokenizeWhere(query.getFilter());
        String delimited = toString(split, " || ");
        System.out.println("delimited: " + delimited);
        Assert.assertEquals("o.birthday > :from and o.birthday < :to and o.id = :id ", toString(split));
        Assert.assertEquals(11, split.size());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.