Search in sources :

Example 1 with MtTable2

use of org.apache.cayenne.testdo.mt.MtTable2 in project cayenne by apache.

the class CayenneContextRelationshipsIT method testLostUncommittedToOneModifications_Server.

@Test
public void testLostUncommittedToOneModifications_Server() throws Exception {
    tMtTable1.insert(1, "G1", "S1");
    tMtTable1.insert(2, "G2", "S2");
    tMtTable2.insert(33, 1, "GX");
    MtTable2 o = Cayenne.objectForPK(serverContext, MtTable2.class, 33);
    MtTable1 r2 = Cayenne.objectForPK(serverContext, MtTable1.class, 2);
    MtTable1 r1 = o.getTable1();
    o.setTable1(r2);
    assertSame(r2, o.getTable1());
    assertFalse(r1.getTable2Array().contains(o));
    assertSame(r2, o.getTable1());
}
Also used : MtTable2(org.apache.cayenne.testdo.mt.MtTable2) ClientMtTable2(org.apache.cayenne.testdo.mt.ClientMtTable2) MtTable1(org.apache.cayenne.testdo.mt.MtTable1) ClientMtTable1(org.apache.cayenne.testdo.mt.ClientMtTable1) Test(org.junit.Test)

Aggregations

ClientMtTable1 (org.apache.cayenne.testdo.mt.ClientMtTable1)1 ClientMtTable2 (org.apache.cayenne.testdo.mt.ClientMtTable2)1 MtTable1 (org.apache.cayenne.testdo.mt.MtTable1)1 MtTable2 (org.apache.cayenne.testdo.mt.MtTable2)1 Test (org.junit.Test)1