Package org.apache.cayenne.access

Examples of org.apache.cayenne.access.DataContext.performQuery()


       
        EJBQLQuery ejbql = new EJBQLQuery("select a from Artist a");
        ejbql.setStatementFetchSize(10);
       
        assertEquals(10, ejbql.getMetaData(dataContext.getEntityResolver()).getStatementFetchSize());
        dataContext.performQuery(ejbql);
       
        ObjectId id = new ObjectId("Artist", Artist.ARTIST_ID_PK_COLUMN, 1);
        RelationshipQuery relationshipQuery = new RelationshipQuery(id, Artist.PAINTING_ARRAY_PROPERTY, true);
        relationshipQuery.setStatementFetchSize(10);
       
View Full Code Here


        ObjectId id = new ObjectId("Artist", Artist.ARTIST_ID_PK_COLUMN, 1);
        RelationshipQuery relationshipQuery = new RelationshipQuery(id, Artist.PAINTING_ARRAY_PROPERTY, true);
        relationshipQuery.setStatementFetchSize(10);
       
        assertEquals(10, relationshipQuery.getMetaData(dataContext.getEntityResolver()).getStatementFetchSize());
        dataContext.performQuery(relationshipQuery);
    }
}
View Full Code Here

        Artist a3 = (Artist) context.newObject("Artist");
        a3.setArtistName("abc3");

        context.commitChanges();

        List artists = context.performQuery(new SelectQuery(Artist.class));
        assertEquals(3, artists.size());
    }

    public void testSetObjectId() {
        DataContext context = createDataContext();
View Full Code Here

        SelectQuery q = new SelectQuery("Artist", ExpressionFactory.matchExp(
                "artistName",
                artistName));

        List artists = context.performQuery(q);
        assertEquals(1, artists.size());
        Artist o1 = (Artist) artists.get(0);
        assertNotNull(o1);
        assertEquals(artistName, o1.getArtistName());
    }
View Full Code Here

        getDomain().getEventManager().removeAllListeners(
                getDomain().getSharedSnapshotCache().getSnapshotEventSubject());
        getDomain().getSharedSnapshotCache().clear();
        context = getDomain().createDataContext();

        List artists = context.performQuery(new SelectQuery(Artist.class));
        Artist artist = (Artist) artists.get(0);

        assertFalse(DataObject.DEFAULT_VERSION == artist.getSnapshotVersion());
        assertEquals(context
                .getObjectStore()
View Full Code Here

                } else if (getOptionLabel() != null && !orderingApplied) {
                    query.addOrdering(getOptionLabel(), true);
                    orderingApplied = true;
                }

                list = dataContext.performQuery(query);

            } else if (getNamedQuery() != null) {
                list = dataContext.performQuery(getNamedQuery());

            } else if (getQueryName() != null) {
View Full Code Here

                }

                list = dataContext.performQuery(query);

            } else if (getNamedQuery() != null) {
                list = dataContext.performQuery(getNamedQuery());

            } else if (getQueryName() != null) {
                 list = dataContext.performQuery(getQueryName(), false);

            } else {
View Full Code Here

            } else if (getNamedQuery() != null) {
                list = dataContext.performQuery(getNamedQuery());

            } else if (getQueryName() != null) {
                 list = dataContext.performQuery(getQueryName(), false);

            } else {
                Class doClass = form.getDataObjectClass();
                String getterName = ClickUtils.toGetterName(getName());
                Method method = doClass.getMethod(getterName, null);
View Full Code Here

                } else if (getOptionLabel() != null && !orderingApplied) {
                    query.addOrdering(getOptionLabel(), true);
                    orderingApplied = true;
                }

                list = dataContext.performQuery(query);
            }

            if (isRequired() && getOptionList().isEmpty() || isOptional()) {
                getOptionList().add(Option.EMPTY_OPTION);
            }
View Full Code Here

        DataContext dataContext = DataContext.getThreadDataContext();

        List list = Collections.EMPTY_LIST;

        if (getSelectQuery() != null) {
            list = dataContext.performQuery(getSelectQuery());

        } else if (getNamedQuery() != null) {
            list = dataContext.performQuery(getNamedQuery());

        } else if (getQueryName() != null) {
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.