Examples of newObject()


Examples of org.apache.cayenne.ObjectContext.newObject()

        assertFalse(context.hasChanges());
        assertFalse(child1.hasChanges());

        context.newObject(Artist.class);
        child1.newObject(Artist.class);

        assertTrue(context.hasChanges());
        assertTrue(child1.hasChanges());

        child1.rollbackChanges();
View Full Code Here

Examples of org.apache.cayenne.ObjectContext.newObject()

        assertFalse(context.hasChanges());
        assertFalse(child1.hasChanges());

        context.newObject(Artist.class);
        child1.newObject(Artist.class);

        assertTrue(context.hasChanges());
        assertTrue(child1.hasChanges());

        child1.rollbackChangesLocally();
View Full Code Here

Examples of org.apache.cayenne.ObjectContext.newObject()

public class EnumTest extends CayenneCase {

    public void testInsert() {
        ObjectContext context = createDataContext();

        EnumEntity e = context.newObject(EnumEntity.class);
        e.setEnumAttribute(Enum1.one);

        context.commitChanges();
    }
View Full Code Here

Examples of org.apache.cayenne.ObjectContext.newObject()

        DataContext context = createDataContext();
        ObjectContext childContext = context.createChildContext();

        Artist a = Cayenne.objectForPK(childContext, Artist.class, 33001);
        Painting p = childContext.newObject(Painting.class);
        p.setPaintingTitle("X");
        a.addToPaintingArray(p);

        childContext.commitChangesToParent();
View Full Code Here

Examples of org.apache.cayenne.ObjectContext.newObject()

        query.addOrdering(Artist.ARTIST_NAME_PROPERTY, SortOrder.ASCENDING);
        List objects = childContext.performQuery(query);

        assertEquals(4, objects.size());

        Artist childNew = childContext.newObject(Artist.class);
        childNew.setArtistName("NNN");

        Artist childModified = (Artist) objects.get(0);
        childModified.setArtistName("MMM");
View Full Code Here

Examples of org.apache.cayenne.ObjectContext.newObject()

        query.addOrdering(Artist.ARTIST_NAME_PROPERTY, SortOrder.ASCENDING);
        List objects = childContext.performQuery(query);

        assertEquals(4, objects.size());

        Artist childNew = childContext.newObject(Artist.class);
        childNew.setArtistName("NNN");

        Artist childModified = (Artist) objects.get(0);
        childModified.setArtistName("MMM");
View Full Code Here

Examples of org.apache.cayenne.ObjectContext.newObject()

        ObjectContext context = createDataContext();
        ObjEntity entity = context.getEntityResolver().lookupObjEntity(MtTable1Subclass.class);
        Expression qualifier = entity.getDeclaredQualifier();
       
        try {
            MtTable1Subclass ee = context.newObject(MtTable1Subclass.class);
            assertEquals(ee.getGlobalAttribute1(), "sub1");
           
            //check AND
            entity.setDeclaredQualifier(qualifier.andExp(Expression.fromString("serverAttribute1 = 'sa'")));
            ee = context.newObject(MtTable1Subclass.class);
View Full Code Here

Examples of org.apache.cayenne.ObjectContext.newObject()

            MtTable1Subclass ee = context.newObject(MtTable1Subclass.class);
            assertEquals(ee.getGlobalAttribute1(), "sub1");
           
            //check AND
            entity.setDeclaredQualifier(qualifier.andExp(Expression.fromString("serverAttribute1 = 'sa'")));
            ee = context.newObject(MtTable1Subclass.class);
            assertEquals(ee.getGlobalAttribute1(), "sub1");
            assertEquals(ee.getServerAttribute1(), "sa");
        }
        finally {
            entity.setDeclaredQualifier(qualifier);
View Full Code Here

Examples of org.apache.cayenne.ObjectContext.newObject()

        ObjectContext context = createROPContext();
        ObjEntity entity = context.getEntityResolver().lookupObjEntity(ClientMtTable1Subclass.class);
        Expression qualifier = entity.getDeclaredQualifier();
       
        try {
            ClientMtTable1Subclass ee = context.newObject(ClientMtTable1Subclass.class);
            assertEquals(ee.getGlobalAttribute1(), "sub1");
           
            //check AND
            entity.setDeclaredQualifier(qualifier.andExp(Expression.fromString("serverAttribute1 = 'sa'")));
            ee = context.newObject(ClientMtTable1Subclass.class);
View Full Code Here

Examples of org.apache.cayenne.ObjectContext.newObject()

            ClientMtTable1Subclass ee = context.newObject(ClientMtTable1Subclass.class);
            assertEquals(ee.getGlobalAttribute1(), "sub1");
           
            //check AND
            entity.setDeclaredQualifier(qualifier.andExp(Expression.fromString("serverAttribute1 = 'sa'")));
            ee = context.newObject(ClientMtTable1Subclass.class);
            assertEquals(ee.getGlobalAttribute1(), "sub1");
            assertEquals(ee.getServerAttribute1(), "sa");
        }
        finally {
            entity.setDeclaredQualifier(qualifier);
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.