Package org.apache.cayenne.query

Examples of org.apache.cayenne.query.SelectQuery.andQualifier()


   
    public void testSelectWithOuterJoinFlattened() throws Exception {
        createTestData("testSelectWithOuterJoinFlattened");

        SelectQuery missingToManyQuery = new SelectQuery(Artist.class);
        missingToManyQuery.andQualifier(ExpressionFactory.matchExp(
                Artist.GROUP_ARRAY_PROPERTY + Entity.OUTER_JOIN_INDICATOR,
                null));
        missingToManyQuery.addOrdering(Artist.ARTIST_NAME_PROPERTY, Ordering.ASC);

        List<Artist> artists = createDataContext().performQuery(missingToManyQuery);
View Full Code Here


    public void testSelectWithOuterJoin() throws Exception {

        createTestData("testSelectWithOuterJoin");

        SelectQuery missingToManyQuery = new SelectQuery(Artist.class);
        missingToManyQuery.andQualifier(ExpressionFactory.matchExp(
                Artist.PAINTING_ARRAY_PROPERTY + Entity.OUTER_JOIN_INDICATOR,
                null));
        missingToManyQuery.addOrdering(Artist.ARTIST_NAME_PROPERTY, Ordering.ASC);

        List<Artist> artists = createDataContext().performQuery(missingToManyQuery);
View Full Code Here

        List<Artist> artists = createDataContext().performQuery(missingToManyQuery);
        assertEquals(2, artists.size());
        assertEquals("BB1", artists.get(0).getArtistName());

        SelectQuery mixedConditionQuery = new SelectQuery(Artist.class);
        mixedConditionQuery.andQualifier(ExpressionFactory.matchExp(
                Artist.PAINTING_ARRAY_PROPERTY + Entity.OUTER_JOIN_INDICATOR,
                null));
        mixedConditionQuery.orQualifier(ExpressionFactory.matchExp(
                Artist.ARTIST_NAME_PROPERTY,
                "AA1"));
View Full Code Here

    public void testSelectWithOuterJoinFromString() throws Exception {

        createTestData("testSelectWithOuterJoin");

        SelectQuery missingToManyQuery = new SelectQuery(Artist.class);
        missingToManyQuery.andQualifier(Expression.fromString("paintingArray+ = null"));
        missingToManyQuery.addOrdering(Artist.ARTIST_NAME_PROPERTY, Ordering.ASC);

        List<Artist> artists = createDataContext().performQuery(missingToManyQuery);
        assertEquals(2, artists.size());
        assertEquals("BB1", artists.get(0).getArtistName());
View Full Code Here

        List<Artist> artists = createDataContext().performQuery(missingToManyQuery);
        assertEquals(2, artists.size());
        assertEquals("BB1", artists.get(0).getArtistName());

        SelectQuery mixedConditionQuery = new SelectQuery(Artist.class);
        mixedConditionQuery.andQualifier(ExpressionFactory.matchExp(
                Artist.PAINTING_ARRAY_PROPERTY + Entity.OUTER_JOIN_INDICATOR,
                null));
        mixedConditionQuery.orQualifier(ExpressionFactory.matchExp(
                Artist.ARTIST_NAME_PROPERTY,
                "AA1"));
View Full Code Here

public class PostCodeService extends CayenneTemplate {

    public List getPostCodeLocations(String location) {
        SelectQuery query = new SelectQuery(PostCode.class);

        query.andQualifier(ExpressionFactory.likeIgnoreCaseExp(PostCode.LOCALITY_PROPERTY, location + "%"));

        query.addOrdering(PostCode.LOCALITY_PROPERTY, true);

        query.setFetchLimit(10);
View Full Code Here

    public List getCustomers(String name, Date startDate) {
        SelectQuery query = new SelectQuery(Customer.class);

        if (StringUtils.isNotBlank(name)) {
            query.andQualifier(ExpressionFactory.likeIgnoreCaseExp(Customer.NAME_PROPERTY, "%" + name + "%"));
        }
        if (startDate != null) {
            query.andQualifier(ExpressionFactory.greaterOrEqualExp(Customer.DATE_JOINED_PROPERTY, startDate));
        }
View Full Code Here

        if (StringUtils.isNotBlank(name)) {
            query.andQualifier(ExpressionFactory.likeIgnoreCaseExp(Customer.NAME_PROPERTY, "%" + name + "%"));
        }
        if (startDate != null) {
            query.andQualifier(ExpressionFactory.greaterOrEqualExp(Customer.DATE_JOINED_PROPERTY, startDate));
        }

        query.addOrdering(Customer.NAME_PROPERTY, true);
        query.addOrdering(Customer.DATE_JOINED_PROPERTY, true);
View Full Code Here

    }

    public List getCustomerNamesLike(String name) {
        SelectQuery query = new SelectQuery(Customer.class);

        query.andQualifier(ExpressionFactory.likeIgnoreCaseExp(Customer.NAME_PROPERTY, "%" + name + "%"));

        query.addOrdering(Customer.NAME_PROPERTY, true);

        query.setFetchLimit(10);
View Full Code Here

        }
    }

    public Customer findCustomerByName(String name) {
        SelectQuery query = new SelectQuery(Customer.class);
        query.andQualifier(ExpressionFactory.matchExp(Customer.NAME_PROPERTY,name));

        List list = performQuery(query);

        if (!list.isEmpty()) {
            return (Customer) list.get(0);
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.