Examples of BooleanIdEntity


Examples of org.apache.openjpa.persistence.identity.BooleanIdEntity

    }

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

        Boolean id = Boolean.valueOf(true);
        BooleanIdEntity entity = new BooleanIdEntity();
        entity.setId(id);

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

        BooleanIdEntity persistedEntity = em.find(BooleanIdEntity.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.