Examples of SecondaryTableEntity


Examples of org.apache.cayenne.jpa.itest.ch9.entity.SecondaryTableEntity

    public void testPersist() throws Exception {
        getDbHelper().deleteAll("SecondaryTable");
        getDbHelper().deleteAll("PrimaryTable");

        SecondaryTableEntity o1 = new SecondaryTableEntity();
        o1.setPrimaryTableProperty("p1");
        o1.setSecondaryTableProperty("s1");

        getEntityManager().persist(o1);
        getEntityManager().getTransaction().commit();
       
        assertTrue(o1.getId() > 0);

        assertEquals("p1", getDbHelper().getObject("PrimaryTable", "primaryTableProperty"));
        assertEquals("s1", getDbHelper().getObject("SecondaryTable", "secondaryTableProperty"));
        assertEquals(o1.getId(), getDbHelper().getObject("SecondaryTable", "id"));
    }
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.