Examples of SQLBigIntegerIdEntity


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

    }

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

        BigInteger id = BigInteger.valueOf(1);
        SQLBigIntegerIdEntity entity = new SQLBigIntegerIdEntity();
        entity.setId(id);

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

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