Examples of EmbeddedIdEntity


Examples of org.apache.cayenne.jpa.itest.ch2.entity.EmbeddedIdEntity

        assertEquals("p1", getDbHelper().getObject("IdClassEntity", "property1"));
    }

    // TODO: andrus 8/10/2006 - fails
    public void _testEmbeddedIdPk() throws Exception {
        EmbeddedIdEntity o1 = new EmbeddedIdEntity();
        o1.setProperty1("p1");
        getEntityManager().persist(o1);
        getEntityManager().getTransaction().commit();

        assertEquals("p1", getDbHelper().getObject("EmbeddedIdEntity", "property1"));
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.EmbeddedIdEntity

    }

    public void testEmbeddedId() throws Exception {
        ClassMetaData cmd = repo.getMetaData(EmbeddedIdEntity.class, null, true);
        try {
            JPAFacadeHelper.toOpenJPAObjectId(cmd, new EmbeddedIdEntity());
            fail("Didn't fail!");
        } catch (UserException re) {
            // expected
        }

        // Initialize and persist entity
        EmbeddedIdClass id = new EmbeddedIdClass();
        id.setPk1(1);
        id.setPk2(2);
        EmbeddedIdEntity entity = new EmbeddedIdEntity();
        entity.setId(id);

        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        em.persist(entity);
        em.getTransaction().commit();
        em.clear();

        // Find the entity and retrieve the objectId we use internally
        EmbeddedIdEntity persistedEntity = em.find(EmbeddedIdEntity.class, id);
        StateManagerImpl smi = ((StateManagerImpl) ((PersistenceCapable) persistedEntity).pcGetStateManager());
        Object oid = smi.getObjectId();

        assertEquals(oid, JPAFacadeHelper.toOpenJPAObjectId(cmd, id));
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.EmbeddedIdEntity

    }

    public void testEmbeddedId() throws Exception {
        ClassMetaData cmd = repo.getMetaData(EmbeddedIdEntity.class, null, true);
        try {
            JPAFacadeHelper.toOpenJPAObjectId(cmd, new EmbeddedIdEntity());
            fail("Didn't fail!");
        } catch (UserException re) {
            // expected

        }
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.