Package org.apache.cayenne

Examples of org.apache.cayenne.ObjectContext.performQuery()


            ObjectContext context = commanderAccount.getObjectContext();
            context.deleteObject(m);
            commanderAccount.updateRow();
            user.sendChat(response, true);

            context.performQuery(new RefreshQuery(commanderAccount));
          } catch(Exception e) {
            throw new CommandFailedWithDetailsException("Failed to delete mail", e);
          }
        } else {
          throw new CommandFailedWithDetailsException("You only have " + rsMail.size() + " messages!");
View Full Code Here


        query.andQualifier(ExpressionFactory.matchAllExp(
                "|exhibitArray.artistExhibitArray.toArtist",
                picasso,
                dali));

        List<Gallery> galleries = context.performQuery(query);

        assertEquals(1, galleries.size());
        assertEquals("G1", galleries.get(0).getGalleryName());
    }
View Full Code Here

        SelectQuery query = new SelectQuery(EmbedEntity1.class);
        query.addOrdering(EmbedEntity1.NAME_PROPERTY, SortOrder.ASCENDING);

        ObjectContext context = createDataContext();

        List results = context.performQuery(query);
        assertEquals(2, results.size());

        EmbedEntity1 o1 = (EmbedEntity1) results.get(0);

        assertEquals("n1", o1.getName());
View Full Code Here

        SelectQuery query = new SelectQuery(EmbedEntity1.class);
        query.addOrdering(EmbedEntity1.NAME_PROPERTY, SortOrder.ASCENDING);

        ObjectContext context = createDataContext();
        List results = context.performQuery(query);
        EmbedEntity1 o1 = (EmbedEntity1) results.get(0);

        Embeddable1 e11 = o1.getEmbedded1();
        e11.setEmbedded10("x1");
View Full Code Here

        SelectQuery query = new SelectQuery(EmbedEntity1.class);
        query.addOrdering(EmbedEntity1.NAME_PROPERTY, SortOrder.ASCENDING);

        ObjectContext context = createDataContext();
        List results = context.performQuery(query);
        EmbedEntity1 o1 = (EmbedEntity1) results.get(0);

        Embeddable1 e11 = new Embeddable1();
        e11.setEmbedded10("x1");
        e11.setEmbedded20("x2");
View Full Code Here

        obj.setDescr("aaa-aaa");
        context.commitChanges();

        // must be able to resolve to-many relationship
        ObjectContext context = runtime.getContext();
        List objects = context.performQuery(new SelectQuery(MeaningfulPKTest1.class));
        assertEquals(1, objects.size());
        obj = (MeaningfulPKTest1) objects.get(0);
        assertEquals(0, obj.getMeaningfulPKDepArray().size());
    }
View Full Code Here

                + " WHERE m MEMBER d.employees";

        ObjectContext context = createDataContext();

        EJBQLQuery query = new EJBQLQuery(ejbql);
        List<?> objects = context.performQuery(query);
        assertEquals(2, objects.size());

        Set<String> ids = new HashSet<String>();
        Iterator<?> it = objects.iterator();
        while (it.hasNext()) {
View Full Code Here

                + " WHERE m NOT MEMBER d.employees";

        ObjectContext context = createDataContext();

        EJBQLQuery query = new EJBQLQuery(ejbql);
        List<?> objects = context.performQuery(query);
        assertEquals(1, objects.size());

        Set<String> ids = new HashSet<String>();
        Iterator<?> it = objects.iterator();
        while (it.hasNext()) {
View Full Code Here

                + " WHERE m NOT MEMBER d.employees";

        ObjectContext context = createDataContext();

        EJBQLQuery query = new EJBQLQuery(ejbql);
        List<?> objects = context.performQuery(query);
        assertEquals(0, objects.size());
    }
}
View Full Code Here

        ObjectContext childContext = context.createChildContext();

        // make sure we fetch in predictable order
        SelectQuery query = new SelectQuery(Painting.class);
        query.addOrdering(Painting.PAINTING_TITLE_PROPERTY, SortOrder.ASCENDING);
        List objects = childContext.performQuery(query);

        assertEquals(6, objects.size());

        Painting childModifiedSimple = (Painting) objects.get(0);
        childModifiedSimple.setPaintingTitle("C_PT");
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.