Examples of SQLBigDecimalIdEntity


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

    }

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

        BigDecimal id = BigDecimal.valueOf(1);
        SQLBigDecimalIdEntity entity = new SQLBigDecimalIdEntity();
        entity.setId(id);

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

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