Package org.apache.cayenne.testdo.mt

Examples of org.apache.cayenne.testdo.mt.ClientMtTable1.addToTable2Array()


        ClientMtTable2 p = child.newObject(ClientMtTable2.class);
        ClientMtTable1 aChild = (ClientMtTable1) Cayenne.objectForPK(
                child,
                a.getObjectId());
        p.setGlobalAttribute("X");
        aChild.addToTable2Array(p);

        child.commitChangesToParent();

        child.deleteObjects(p);
        aChild.removeFromTable2Array(p);
View Full Code Here


     * A test case for CAY-698 bug.
     */
    public void testNullifyToOne() throws Exception {
        ClientMtTable1 a = clientContext.newObject(ClientMtTable1.class);
        ClientMtTable2 b = clientContext.newObject(ClientMtTable2.class);
        a.addToTable2Array(b);

        clientContext.commitChanges();

        final ObjectContext child = clientContext.createChildContext();
        ObjectContext childPeer = clientContext.createChildContext();
View Full Code Here

        a.setGlobalAttribute1("X");
        child.commitChanges();

        ClientMtTable2 p1 = child.newObject(ClientMtTable2.class);
        p1.setGlobalAttribute("P1");
        a.addToTable2Array(p1);

        ClientMtTable2 p2 = child.newObject(ClientMtTable2.class);
        p2.setGlobalAttribute("P2");
        a.addToTable2Array(p2);
View Full Code Here

        p1.setGlobalAttribute("P1");
        a.addToTable2Array(p1);

        ClientMtTable2 p2 = child.newObject(ClientMtTable2.class);
        p2.setGlobalAttribute("P2");
        a.addToTable2Array(p2);

        a.removeFromTable2Array(p2);

        // this causes an error on commit
        child.deleteObjects(p2);
View Full Code Here

        ClientMtTable2 b = child.newObject(ClientMtTable2.class);
        child.commitChanges();

        assertEquals(PersistenceState.COMMITTED, a.getPersistenceState());

        a.addToTable2Array(b);
        assertEquals(PersistenceState.MODIFIED, a.getPersistenceState());

        child.commitChangesToParent();
        ClientMtTable1 parentA = (ClientMtTable1) clientContext
                .getGraphManager()
View Full Code Here

    public void testCommitChangesToParentOneToMany() throws Exception {
        ObjectContext child = clientContext.createChildContext();

        ClientMtTable1 master = child.newObject(ClientMtTable1.class);
        ClientMtTable2 dep = child.newObject(ClientMtTable2.class);
        master.addToTable2Array(dep);

        child.commitChangesToParent();

        ClientMtTable1 masterParent = (ClientMtTable1) clientContext
                .getGraphManager()
View Full Code Here

        assertEquals(1, o1.getTable2Array().size());

        ClientMtTable2 o1r = c1.newObject(ClientMtTable2.class);
        o1r.setGlobalAttribute("X");
        o1.addToTable2Array(o1r);

        c1.commitChanges();

        assertEquals(2, o1.getTable2Array().size());
View Full Code Here

                    new ClientChannelServerDiffsListener1(),
                    "prePersist");

            ClientMtTable1 o = context.newObject(ClientMtTable1.class);
            ClientMtTable2 o1 = context.newObject(ClientMtTable2.class);
            o.addToTable2Array(o1);
            context.commitChanges();

            assertFalse(o.getObjectId().isTemporary());
            assertEquals(PersistenceState.COMMITTED, o.getPersistenceState());
            assertEquals("XXX", o.getGlobalAttribute1());
View Full Code Here

                    new ClientChannelServerDiffsListener1(),
                    "prePersistAddRelationship");

            ClientMtTable1 o = context.newObject(ClientMtTable1.class);
            ClientMtTable2 o1 = context.newObject(ClientMtTable2.class);
            o.addToTable2Array(o1);
            context.commitChanges();

            assertFalse(o.getObjectId().isTemporary());
            assertEquals(PersistenceState.COMMITTED, o.getPersistenceState());
            assertEquals(2, o.getTable2Array().size());
View Full Code Here

        ObjectContext childContext = runtime.getContext(context);
        final ShallowMergeOperation op = new ShallowMergeOperation(childContext);

        ClientMtTable1 _new = context.newObject(ClientMtTable1.class);
        final ClientMtTable2 _new2 = context.newObject(ClientMtTable2.class);
        _new.addToTable2Array(_new2);

        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {
                ClientMtTable2 child2 = op.merge(_new2);
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.