Package org.apache.cayenne.testdo.testmap

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


        deleteTestData();
        ctxt = createDataContext();
    }

    public void testInsert() throws Exception {
        CharPkTestEntity object = (CharPkTestEntity) ctxt.newObject("CharPkTestEntity");
        object.setOtherCol("object-XYZ");
        object.setPkCol("PK1");
        ctxt.commitChanges();

        SQLTemplate q = new SQLTemplate(
                CharPkTestEntity.class,
                "SELECT * FROM CHAR_PK_TEST");
View Full Code Here


        }
        assertEquals("PK1", val);
    }

    public void testDelete() throws Exception {
        CharPkTestEntity object = (CharPkTestEntity) ctxt.newObject("CharPkTestEntity");
        object.setOtherCol("object-XYZ");
        object.setPkCol("PK1");
        ctxt.commitChanges();

        ctxt.deleteObject(object);
        ctxt.commitChanges();
View Full Code Here

        assertNotNull(rows);
        assertEquals(0, rows.size());
    }

    public void testUpdate() throws Exception {
        CharPkTestEntity object = (CharPkTestEntity) ctxt.newObject("CharPkTestEntity");
        object.setOtherCol("object-XYZ");
        object.setPkCol("PK1");
        ctxt.commitChanges();

        object.setOtherCol("UPDATED");
        ctxt.commitChanges();

        SQLTemplate q = new SQLTemplate(
                CharPkTestEntity.class,
                "SELECT * FROM CHAR_PK_TEST");
View Full Code Here

        q.addOrdering(CharPkTestEntity.OTHER_COL_PROPERTY, SortOrder.ASCENDING);

        List pks = context.performQuery(q);
        assertEquals(2, pks.size());

        CharPkTestEntity pk1 = (CharPkTestEntity) pks.get(0);
        assertEquals("n1", pk1.getOtherCol());
        List toMany = (List) pk1.readPropertyDirectly("charFKs");
        assertNotNull(toMany);
        assertFalse(((ValueHolder) toMany).isFault());
        assertEquals(3, toMany.size());

        CharFkTestEntity fk1 = (CharFkTestEntity) toMany.get(0);
View Full Code Here

        dbHelper.deleteAll("CHAR_FK_TEST");
        dbHelper.deleteAll("CHAR_PK_TEST");
    }

    public void testInsert() throws Exception {
        CharPkTestEntity object = context.newObject(CharPkTestEntity.class);
        object.setOtherCol("object-XYZ");
        object.setPkCol("PK1");
        context.commitChanges();

        SQLTemplate q = new SQLTemplate(
                CharPkTestEntity.class,
                "SELECT * FROM CHAR_PK_TEST");
View Full Code Here

        }
        assertEquals("PK1", val);
    }

    public void testDelete() throws Exception {
        CharPkTestEntity object = context.newObject(CharPkTestEntity.class);
        object.setOtherCol("object-XYZ");
        object.setPkCol("PK1");
        context.commitChanges();

        context.deleteObjects(object);
        context.commitChanges();
View Full Code Here

        assertNotNull(rows);
        assertEquals(0, rows.size());
    }

    public void testUpdate() throws Exception {
        CharPkTestEntity object = context.newObject(CharPkTestEntity.class);
        object.setOtherCol("object-XYZ");
        object.setPkCol("PK1");
        context.commitChanges();

        object.setOtherCol("UPDATED");
        context.commitChanges();

        SQLTemplate q = new SQLTemplate(
                CharPkTestEntity.class,
                "SELECT * FROM CHAR_PK_TEST");
View Full Code Here

        q.addOrdering(CharPkTestEntity.OTHER_COL_PROPERTY, SortOrder.ASCENDING);

        List<?> pks = context.performQuery(q);
        assertEquals(2, pks.size());

        CharPkTestEntity pk1 = (CharPkTestEntity) pks.get(0);
        assertEquals("n1", pk1.getOtherCol());
        List<?> toMany = (List<?>) pk1.readPropertyDirectly("charFKs");
        assertNotNull(toMany);
        assertFalse(((ValueHolder) toMany).isFault());
        assertEquals(3, toMany.size());

        CharFkTestEntity fk1 = (CharFkTestEntity) toMany.get(0);
View Full Code Here

TOP

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

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.