Package org.apache.cayenne.testdo.relationship

Examples of org.apache.cayenne.testdo.relationship.ToManyFkDep


        ToManyRoot2 src2 = context.newObject(ToManyRoot2.class);
        ToManyFkRoot src = context.newObject(ToManyFkRoot.class);

        // this should go away when such mapping becomes fully supported
        src.setDepId(new Integer(1));
        ToManyFkDep target = context.newObject(ToManyFkDep.class);

        // this should go away when such mapping becomes fully supported
        target.setDepId(new Integer(1));
        target.setRoot2(src2);

        src.addToDeps(target);
        context.commitChanges();

        context.invalidateObjects(Arrays.asList(src, target, src2));

        ToManyFkRoot src1 = (ToManyFkRoot) Cayenne.objectForPK(context, src
                .getObjectId());
        assertNotNull(src1.getDeps());
        assertEquals(1, src1.getDeps().size());
        // resolve HOLLOW
        assertSame(src1, ((ToManyFkDep) src1.getDeps().get(0)).getRoot());

        context.invalidateObjects(Arrays.asList(src1, src1.getDeps().get(0)));

        ToManyFkDep target2 = (ToManyFkDep) Cayenne.objectForPK(context, target
                .getObjectId());
        assertNotNull(target2.getRoot());

        // resolve HOLLOW
        assertSame(target2, target2.getRoot().getDeps().get(0));
    }
View Full Code Here


        ToManyRoot2 src2 = context.newObject(ToManyRoot2.class);
        ToManyFkRoot src = context.newObject(ToManyFkRoot.class);

        // this should go away when such mapping becomes fully supported
        src.setDepId(new Integer(1));
        ToManyFkDep target = context.newObject(ToManyFkDep.class);

        // this should go away when such mapping becomes fully supported
        target.setDepId(new Integer(1));
        target.setRoot2(src2);

        src.addToDeps(target);
        context.commitChanges();

        context.invalidateObjects(Arrays.asList(src, target, src2));

        ToManyFkRoot src1 = (ToManyFkRoot) DataObjectUtils.objectForPK(context, src
                .getObjectId());
        assertNotNull(src1.getDeps());
        assertEquals(1, src1.getDeps().size());
        // resolve HOLLOW
        assertSame(src1, ((ToManyFkDep) src1.getDeps().get(0)).getRoot());

        context.invalidateObjects(Arrays.asList(src1, src1.getDeps().get(0)));

        ToManyFkDep target2 = (ToManyFkDep) DataObjectUtils.objectForPK(context, target
                .getObjectId());
        assertNotNull(target2.getRoot());

        // resolve HOLLOW
        assertSame(target2, target2.getRoot().getDeps().get(0));
    }
View Full Code Here

        ToManyRoot2 src2 = context.newObject(ToManyRoot2.class);
        ToManyFkRoot src = context.newObject(ToManyFkRoot.class);

        // this should go away when such mapping becomes fully supported
        src.setDepId(new Integer(1));
        ToManyFkDep target = context.newObject(ToManyFkDep.class);

        // this should go away when such mapping becomes fully supported
        target.setDepId(new Integer(1));
        target.setRoot2(src2);

        src.addToDeps(target);
        context.commitChanges();

        context.invalidateObjects(src, target, src2);

        ToManyFkRoot src1 = (ToManyFkRoot) Cayenne
                .objectForPK(context, src.getObjectId());
        assertNotNull(src1.getDeps());
        assertEquals(1, src1.getDeps().size());
        // resolve HOLLOW
        assertSame(src1, ((ToManyFkDep) src1.getDeps().get(0)).getRoot());

        context.invalidateObjects(src1, src1.getDeps().get(0));

        ToManyFkDep target2 = (ToManyFkDep) Cayenne.objectForPK(context, target
                .getObjectId());
        assertNotNull(target2.getRoot());

        // resolve HOLLOW
        assertSame(target2, target2.getRoot().getDeps().get(0));
    }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.testdo.relationship.ToManyFkDep

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.