Package org.apache.cayenne.query

Examples of org.apache.cayenne.query.SelectQuery


    public void testSuccessSimpleLockingOnUpdatePrecededByForgetSnapshot()
            throws Exception {
        createTestData("testSimpleLocking");

        List allObjects = context.performQuery(new SelectQuery(
                SimpleLockingTestEntity.class));
        assertEquals(1, allObjects.size());

        SimpleLockingTestEntity object = (SimpleLockingTestEntity) allObjects.get(0);
View Full Code Here


    }

    public void testFailSimpleLocking() throws Exception {
        createTestData("testSimpleLocking");

        List allObjects = context.performQuery(new SelectQuery(
                SimpleLockingTestEntity.class));
        assertEquals(1, allObjects.size());

        SimpleLockingTestEntity object = (SimpleLockingTestEntity) allObjects.get(0);
View Full Code Here

    }

    public void testFailLockingOnNull() throws Exception {
        createTestData("testLockingOnNull");

        List allObjects = context.performQuery(new SelectQuery(
                SimpleLockingTestEntity.class));
        assertEquals(1, allObjects.size());

        SimpleLockingTestEntity object = (SimpleLockingTestEntity) allObjects.get(0);
View Full Code Here

        }
    }

    public void testSuccessLockingOnMixed() throws Exception {
        createTestData("testLockingOnMixed");
        SelectQuery query = new SelectQuery(SimpleLockingTestEntity.class);
        query.addOrdering(new Ordering("db:LOCKING_TEST_ID", SortOrder.ASCENDING));

        List allObjects = context.performQuery(query);
        assertEquals(3, allObjects.size());

        SimpleLockingTestEntity object1 = (SimpleLockingTestEntity) allObjects.get(0);
View Full Code Here

    public void testFailLockingOnToOne() throws Exception {
        createTestData("testLockingOnToOne");

        List allObjects = context
                .performQuery(new SelectQuery(RelLockingTestEntity.class));
        assertEquals(1, allObjects.size());

        RelLockingTestEntity object = (RelLockingTestEntity) allObjects.get(0);

        // change name and save... no optimistic lock failure expected
View Full Code Here

    }

    public void testFailRetrieveRow() throws Exception {
        createTestData("testSimpleLocking");

        List allObjects = context.performQuery(new SelectQuery(
                SimpleLockingTestEntity.class));
        assertEquals(1, allObjects.size());

        SimpleLockingTestEntity object = (SimpleLockingTestEntity) allObjects.get(0);
        object.setDescription("first update");
View Full Code Here

    }

    public void testFailRetrieveDeletedRow() throws Exception {
        createTestData("testSimpleLocking");

        List allObjects = context.performQuery(new SelectQuery(
                SimpleLockingTestEntity.class));
        assertEquals(1, allObjects.size());

        SimpleLockingTestEntity object = (SimpleLockingTestEntity) allObjects.get(0);
View Full Code Here

    public void testJointPrefetchDataRows() throws Exception {
        createTestData("testJointPrefetch1");

        // query with to-many joint prefetches
        SelectQuery q = new SelectQuery(Painting.class);
        q.addOrdering("db:PAINTING_ID", SortOrder.ASCENDING);
        q.setFetchingDataRows(true);
        q.addPrefetch(Painting.TO_ARTIST_PROPERTY).setSemantics(
                PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);

        DataContext context = createDataContext();

        List rows = context.performQuery(q);
View Full Code Here

    public void testJointPrefetchToOne() throws Exception {
        createTestData("testJointPrefetch1");

        // query with to-many joint prefetches
        SelectQuery q = new SelectQuery(Painting.class);
        q.addOrdering("db:PAINTING_ID", SortOrder.ASCENDING);
        q.addPrefetch(Painting.TO_ARTIST_PROPERTY).setSemantics(
                PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);

        DataContext context = createDataContext();

        List objects = context.performQuery(q);
View Full Code Here

        context.performNonSelectingQuery(artistSQL);
        context.performNonSelectingQuery(paintingSQL);

        // test
        SelectQuery q = new SelectQuery(Painting.class);
        q.addPrefetch(Painting.TO_ARTIST_PROPERTY).setSemantics(
                PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);

        ObjEntity artistE = getObjEntity("Artist");
        ObjAttribute dateOfBirth = (ObjAttribute) artistE.getAttribute("dateOfBirth");
        assertEquals("java.util.Date", dateOfBirth.getType());
View Full Code Here

TOP

Related Classes of org.apache.cayenne.query.SelectQuery

Copyright © 2018 www.massapicom. 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.