Package org.apache.cayenne.testdo.testmap

Examples of org.apache.cayenne.testdo.testmap.CompoundPkTestEntity


        assertEquals(object.getObjectId(), refreshedObject.getObjectId());
    }

    public void testCompoundPkChangeAllElements() throws Exception {

        CompoundPkTestEntity object = context.newObject(CompoundPkTestEntity.class);
        CompoundPkTestEntity refreshedObject = null;

        object.setKey1(key1v1);
        object.setKey2(key2v1);
        object.setName("testing testing");

        context.commitChanges();
        assertEquals(key1v1, object.getObjectId().getIdSnapshot().get(
                CompoundPkTestEntity.KEY1_PK_COLUMN));
        assertEquals(key2v1, object.getObjectId().getIdSnapshot().get(
                CompoundPkTestEntity.KEY2_PK_COLUMN));

        ObjectIdQuery refetch = new ObjectIdQuery(
                object.getObjectId(),
                false,
                ObjectIdQuery.CACHE_REFRESH);
        refreshedObject = (CompoundPkTestEntity) Cayenne.objectForQuery(context, refetch);
        assertEquals(object.getObjectId(), refreshedObject.getObjectId());

        object.setKey1(key1v2);
        object.setKey2(key2v2);

        context.commitChanges();
        assertEquals(key1v2, object.getObjectId().getIdSnapshot().get(
                CompoundPkTestEntity.KEY1_PK_COLUMN));
        assertEquals(key2v2, object.getObjectId().getIdSnapshot().get(
                CompoundPkTestEntity.KEY2_PK_COLUMN));

        ObjectIdQuery refetch1 = new ObjectIdQuery(
                object.getObjectId(),
                false,
                ObjectIdQuery.CACHE_REFRESH);
        refreshedObject = (CompoundPkTestEntity) Cayenne
                .objectForQuery(context, refetch1);
        assertEquals(object.getObjectId(), refreshedObject.getObjectId());

        object.setKey1(key1v3);
        object.setKey2(key2v3);

        context.commitChanges();
        assertEquals(key1v3, object.getObjectId().getIdSnapshot().get(
                CompoundPkTestEntity.KEY1_PK_COLUMN));
        assertEquals(key2v3, object.getObjectId().getIdSnapshot().get(
                CompoundPkTestEntity.KEY2_PK_COLUMN));

        ObjectIdQuery refetch2 = new ObjectIdQuery(
                object.getObjectId(),
                false,
                ObjectIdQuery.CACHE_REFRESH);
        refreshedObject = (CompoundPkTestEntity) Cayenne
                .objectForQuery(context, refetch2);
        assertEquals(object.getObjectId(), refreshedObject.getObjectId());
    }
View Full Code Here


        createTwoCompoundPKTwoFK();

        Map<String, String> key1 = new HashMap<String, String>();
        key1.put(CompoundPkTestEntity.KEY1_PK_COLUMN, "b1");
        key1.put(CompoundPkTestEntity.KEY2_PK_COLUMN, "b2");
        CompoundPkTestEntity a = Cayenne.objectForPK(
                context,
                CompoundPkTestEntity.class,
                key1);

        String ejbql = "select e from CompoundFkTestEntity e WHERE e.toCompoundPk = :param";
View Full Code Here

        createTwoCompoundPKTwoFK();

        Map<String, String> key1 = new HashMap<String, String>();
        key1.put(CompoundPkTestEntity.KEY1_PK_COLUMN, "b1");
        key1.put(CompoundPkTestEntity.KEY2_PK_COLUMN, "b2");
        CompoundPkTestEntity a = Cayenne.objectForPK(
                context,
                CompoundPkTestEntity.class,
                key1);

        String ejbql = "select e from CompoundFkTestEntity e WHERE :param = e.toCompoundPk";
View Full Code Here

        createTwoCompoundPKTwoFK();

        Map<String, String> key1 = new HashMap<String, String>();
        key1.put(CompoundPkTestEntity.KEY1_PK_COLUMN, "b1");
        key1.put(CompoundPkTestEntity.KEY2_PK_COLUMN, "b2");
        CompoundPkTestEntity a = Cayenne.objectForPK(
                context,
                CompoundPkTestEntity.class,
                key1);

        String ejbql = "select e from CompoundFkTestEntity e WHERE e.toCompoundPk <> :param";
View Full Code Here

TOP

Related Classes of org.apache.cayenne.testdo.testmap.CompoundPkTestEntity

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.