Examples of MedicalHistory4


Examples of org.apache.openjpa.persistence.enhance.identity.MedicalHistory4

    }

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

        PersonId4 id = new PersonId4("First", "Last");
        Person4 person = new Person4();
        person.setId(id);
        MedicalHistory4 entity = new MedicalHistory4();
        entity.setPatient(person);
        entity.setName("MedicalHistory");

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

        MedicalHistory4 persistedEntity = em.find(MedicalHistory4.class, id);
        StateManagerImpl smi = ((StateManagerImpl) ((PersistenceCapable) persistedEntity).pcGetStateManager());
        Object oid = smi.getObjectId();

        assertEquals(oid, JPAFacadeHelper.toOpenJPAObjectId(cmd, 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.