Package org.apache.cayenne.testdo.mt

Examples of org.apache.cayenne.testdo.mt.ClientMtMapToManyTarget


    public void test() throws Exception {
        deleteTestData();
        ObjectContext context = createROPContext();
       
        ClientMtMapToMany map = context.newObject(ClientMtMapToMany.class);
        ClientMtMapToManyTarget target = context.newObject(ClientMtMapToManyTarget.class);
        target.setMapToMany(map);
        context.commitChanges();
       
        context.performQuery(new RefreshQuery());
       
        SelectQuery query = new SelectQuery(ClientMtMapToMany.class);
View Full Code Here


        Map targets = o1.getTargets();
        assertNotNull(targets);
        assertEquals(3, targets.size());

        ClientMtMapToManyTarget newTarget = o1
                .getObjectContext()
                .newObject(ClientMtMapToManyTarget.class);

        o1.addToTargets(newTarget);
        assertEquals(4, targets.size());
        assertSame(o1, newTarget.getMapToMany());

        o1.getObjectContext().commitChanges();

        o1.getObjectContext().performGenericQuery(new RefreshQuery());
        assertEquals(4, o1.getTargets().size());
       
        int newId = DataObjectUtils.intPKForObject(newTarget);
        assertSame(newTarget, o1.getTargets().get(new Integer(newId)));
       
        assertEquals(PersistenceState.COMMITTED, o1.getPersistenceState());
        assertEquals(PersistenceState.COMMITTED, newTarget.getPersistenceState());
    }
View Full Code Here

    public void test() throws Exception {
        deleteTestData();
        ObjectContext context = createROPContext();
       
        ClientMtMapToMany map = context.newObject(ClientMtMapToMany.class);
        ClientMtMapToManyTarget target = context.newObject(ClientMtMapToManyTarget.class);
        target.setMapToMany(map);
        context.commitChanges();
       
        context.performQuery(new RefreshQuery());
       
        SelectQuery query = new SelectQuery(ClientMtMapToMany.class);
View Full Code Here

        Map<Object, ClientMtMapToManyTarget> targets = o1.getTargets();
        assertNotNull(targets);
        assertEquals(3, targets.size());

        ClientMtMapToManyTarget newTarget = o1.getObjectContext().newObject(
                ClientMtMapToManyTarget.class);

        o1.addToTargets(newTarget);
        assertEquals(4, targets.size());
        assertSame(o1, newTarget.getMapToMany());

        o1.getObjectContext().commitChanges();

        o1.getObjectContext().performGenericQuery(new RefreshQuery());
        assertEquals(4, o1.getTargets().size());

        int newId = Cayenne.intPKForObject(newTarget);
        assertSame(newTarget, o1.getTargets().get(new Integer(newId)));

        assertEquals(PersistenceState.COMMITTED, o1.getPersistenceState());
        assertEquals(PersistenceState.COMMITTED, newTarget.getPersistenceState());
    }
View Full Code Here

   
    public void test() throws Exception {
        ObjectContext context = createROPContext();
       
        ClientMtMapToMany map = context.newObject(ClientMtMapToMany.class);
        ClientMtMapToManyTarget target = context.newObject(ClientMtMapToManyTarget.class);
        target.setMapToMany(map);
        context.commitChanges();
       
        context.performQuery(new RefreshQuery());
       
        SelectQuery query = new SelectQuery(ClientMtMapToMany.class);
View Full Code Here

TOP

Related Classes of org.apache.cayenne.testdo.mt.ClientMtMapToManyTarget

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.