Package org.apache.cayenne.itest.cpa.defaults.client

Examples of org.apache.cayenne.itest.cpa.defaults.client.DefaultsTable3


    ObjectContext clientContext = getClientContext();

    DefaultsTable4 o = (DefaultsTable4) DataObjectUtils.objectForPK(
        clientContext, DefaultsTable4.class, Collections.singletonMap(
            "id", 1));
    DefaultsTable3 o1 = (DefaultsTable3) DataObjectUtils.objectForPK(
        clientContext, DefaultsTable3.class, Collections.singletonMap(
            "id", 1));
    DefaultsTable3 o2 = (DefaultsTable3) DataObjectUtils.objectForPK(
        clientContext, DefaultsTable3.class, Collections.singletonMap(
            "id", 2));

    assertEquals(1, o1.getDefaultTable4s().size());
    assertEquals(0, o2.getDefaultTable4s().size());

    o2.addToDefaultTable4s(o);

    assertEquals(1, o2.getDefaultTable4s().size());
    assertFalse(clientContext.modifiedObjects().isEmpty());
    clientContext.commitChanges();
    assertEquals(1, o2.getDefaultTable4s().size());

    // there is a bug in RefreshQuery that fails to invalidate to-many on
    // the client - so working around it be creating a new context; still
    // running the query though to refresh the server
    clientContext.performQuery(new RefreshQuery());
View Full Code Here

TOP

Related Classes of org.apache.cayenne.itest.cpa.defaults.client.DefaultsTable3

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.