Package org.apache.openjpa.persistence.identity.entityasidentity

Examples of org.apache.openjpa.persistence.identity.entityasidentity.Person


    }

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

        Integer id = Integer.valueOf(1);
        Person entity = new Person();
        entity.setId(id);

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

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

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

TOP

Related Classes of org.apache.openjpa.persistence.identity.entityasidentity.Person

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.