Examples of andQualifier()


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

        Artist picasso = Cayenne.objectForPK(context, Artist.class, 1);
        Artist dali = Cayenne.objectForPK(context, Artist.class, 2);

        SelectQuery query = new SelectQuery(Gallery.class);
        query.andQualifier(ExpressionFactory.matchAllExp(
                "|exhibitArray.artistExhibitArray.toArtist",
                picasso,
                dali));

        List<Gallery> galleries = context.performQuery(query);
View Full Code Here

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

     */
    public void testMultiObjRelFetch() throws Exception {
        createArtistsAndPaintingsDataSet();

        SelectQuery q = new SelectQuery(Painting.class);
        q.andQualifier(ExpressionFactory.matchExp("toArtist.artistName", "artist2"));
        q.orQualifier(ExpressionFactory.matchExp("toArtist.artistName", "artist4"));
        List<Painting> results = context.performQuery(q);

        assertEquals(2, results.size());
    }
View Full Code Here

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

     */
    public void testMultiDbRelFetch() throws Exception {
        createArtistsAndPaintingsDataSet();

        SelectQuery q = new SelectQuery("Painting");
        q.andQualifier(ExpressionFactory.matchDbExp("toArtist.ARTIST_NAME", "artist2"));
        q.orQualifier(ExpressionFactory.matchDbExp("toArtist.ARTIST_NAME", "artist4"));
        List<?> results = context.performQuery(q);

        assertEquals(2, results.size());
    }
View Full Code Here

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

                        "INSERT INTO PERSON (PERSON_ID, NAME, PERSON_TYPE) VALUES (2, 'E2', 'EM')"));
        createDataContext().performGenericQuery(insert);
       
        // fetch on leaf, but match on a super attribute
        SelectQuery select = new SelectQuery(Manager.class);
        select.andQualifier(ExpressionFactory.matchExp(AbstractPerson.NAME_PROPERTY, "E2"));
   
        List<Manager> results = createDataContext().performQuery(select);
        assertEquals(1, results.size());
        assertEquals("E2", results.get(0).getName());
    }
View Full Code Here

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

        createDataContext().performGenericQuery(insert);
       
        // fetch on leaf, but match on a super attribute
        SelectQuery select = new SelectQuery(Employee.class);
        select.addPrefetch(Employee.TO_DEPARTMENT_PROPERTY);
        select.andQualifier(ExpressionFactory.matchExp(AbstractPerson.NAME_PROPERTY, "E2"));
   
        List<Manager> results = createDataContext().performQuery(select);
        assertEquals(1, results.size());
        assertEquals("E2", results.get(0).getName());
    }
View Full Code Here

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

        context.commitChanges();

        SelectQuery query1 = new SelectQuery(Artist.class);

        // per CAY-1074, adding a to-many join to expression messes up the ordering
        query1.andQualifier(ExpressionFactory.noMatchExp(
                Artist.PAINTING_ARRAY_PROPERTY,
                null));
        query1.addOrdering(Artist.ARTIST_NAME_PROPERTY, SortOrder.DESCENDING);
        query1.addOrdering(Artist.DATE_OF_BIRTH_PROPERTY, SortOrder.DESCENDING);
View Full Code Here

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

    @SuppressWarnings("unchecked")
    public List<String> 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

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

    @SuppressWarnings("unchecked")
    public List<Customer> 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

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

        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

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

    @SuppressWarnings("unchecked")
    public List<Customer> 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
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.