Examples of ArtGroup


Examples of org.apache.cayenne.testdo.testmap.ArtGroup

        List<Painting> results = context.performQuery(q);
        assertEquals(1, results.size());
    }

    public void testPrefetch_ReflexiveRelationship() throws Exception {
        ArtGroup parent = (ArtGroup) context.newObject("ArtGroup");
        parent.setName("parent");
        ArtGroup child = (ArtGroup) context.newObject("ArtGroup");
        child.setName("child");
        child.setToParentGroup(parent);
        context.commitChanges();

        SelectQuery q = new SelectQuery("ArtGroup");
        q.setQualifier(ExpressionFactory.matchExp("name", "child"));
        q.addPrefetch("toParentGroup");

        final List<ArtGroup> results = context.performQuery(q);

        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {
                assertEquals(1, results.size());

                ArtGroup fetchedChild = results.get(0);
                // The parent must be fully fetched, not just HOLLOW (a fault)
                assertEquals(PersistenceState.COMMITTED, fetchedChild.getToParentGroup().getPersistenceState());
            }
        });
    }
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.