Package org.apache.openjpa.persistence.meta.common.apps

Examples of org.apache.openjpa.persistence.meta.common.apps.ExternalValues


    public void testInsert() {
        OpenJPAEntityManager pm =
            (OpenJPAEntityManager) currentEntityManager();
        startTx(pm);

        ExternalValues pc = new ExternalValues();
        pc.setBooleanToShort(true);
        pc.setByteToDouble((byte) 4);
        pc.setIntToFloat(4);
        pc.setLongToChar(4);
        pc.setShortToString((short) 4);
        pc.setFloatToBoolean(4.5f);
        pc.setDoubleToByte(4.5);
        pc.setCharToInt('f');
        pc.setStringToLong("foo");

        pm.persist(pc);
        Object oid = pm.getObjectId(pc);
        endTx(pm);
        endEm(pm);

        pm = (OpenJPAEntityManager) currentEntityManager();
        pc = (ExternalValues) pm.find(ExternalValues.class, oid);

        assertTrue(pc.getBooleanToShort());
        assertEquals((byte) 4, pc.getByteToDouble());
        assertEquals(4, pc.getIntToFloat());
        assertEquals(4, pc.getLongToChar());
        assertEquals((short) 4, pc.getShortToString());
        assertTrue(4.5f == pc.getFloatToBoolean());
        assertTrue(4.5 == pc.getDoubleToByte());
        assertEquals('f', pc.getCharToInt());
        assertEquals("foo", pc.getStringToLong());

        endEm(pm);
    }
View Full Code Here


    public void testComplexStrings() {
        OpenJPAEntityManager pm =
            (OpenJPAEntityManager) currentEntityManager();
        startTx(pm);

        ExternalValues pc = new ExternalValues();
        pc.setShortToString((short) 3);
        pc.setStringToLong("long string");

        pm.persist(pc);
        Object oid = pm.getObjectId(pc);
        endTx(pm);
        endEm(pm);

        pm = (OpenJPAEntityManager) currentEntityManager();
        pc = (ExternalValues) pm.find(ExternalValues.class, oid);
        assertEquals(3, pc.getShortToString());
        endEm(pm);
    }
View Full Code Here

    public void testAllNull() {
        OpenJPAEntityManager pm =
            (OpenJPAEntityManager) currentEntityManager();
        startTx(pm);

        ExternalValues pc = new ExternalValues();
        pm.persist(pc);
        Object oid = pm.getObjectId(pc);
        endTx(pm);
        endEm(pm);
View Full Code Here

    public void testInsert() {
        OpenJPAEntityManager pm =
            (OpenJPAEntityManager) currentEntityManager();
        startTx(pm);

        ExternalValues pc = new ExternalValues();
        pc.setBooleanToShort(true);
        pc.setByteToDouble((byte) 4);
        pc.setIntToFloat(4);
        pc.setLongToChar(4);
        pc.setShortToString((short) 4);
        pc.setFloatToBoolean(4.5f);
        pc.setDoubleToByte(4.5);
        pc.setCharToInt('f');
        pc.setStringToLong("foo");
        pm.persist(pc);
        Object oid = pm.getObjectId(pc);
        endTx(pm);
        endEm(pm);

        pm = (OpenJPAEntityManager) currentEntityManager();
        pc = (ExternalValues) pm.find(ExternalValues.class, oid);

        assertTrue(pc.getBooleanToShort());
        assertEquals((byte) 4, pc.getByteToDouble());
        assertEquals(4, pc.getIntToFloat());
        assertEquals(4, pc.getLongToChar());
        assertEquals((short) 4, pc.getShortToString());
        assertTrue(4.5f == pc.getFloatToBoolean());
        assertTrue(4.5 == pc.getDoubleToByte());
        assertEquals('f', pc.getCharToInt());
        assertEquals("foo", pc.getStringToLong());

        endEm(pm);
    }
View Full Code Here

    public void testComplexStrings() {
        OpenJPAEntityManager pm =
            (OpenJPAEntityManager) currentEntityManager();
        startTx(pm);

        ExternalValues pc = new ExternalValues();
        pc.setShortToString((short) 3);
        pc.setStringToLong("long string");

        pm.persist(pc);
        Object oid = pm.getObjectId(pc);
        endTx(pm);
        endEm(pm);

        pm = (OpenJPAEntityManager) currentEntityManager();
        pc = (ExternalValues) pm.find(ExternalValues.class, oid);
        assertEquals(3, pc.getShortToString());
        endEm(pm);
    }
View Full Code Here

    public void testAllNull() {
        OpenJPAEntityManager pm =
            (OpenJPAEntityManager) currentEntityManager();
        startTx(pm);

        ExternalValues pc = new ExternalValues();
        pm.persist(pc);
        Object oid = pm.getObjectId(pc);
        endTx(pm);
        endEm(pm);
View Full Code Here

    }
   
    private void createInstance(UUID uuid) {
        EntityManager em = currentEntityManager();
        em.getTransaction().begin();
        ExternalValues pc = new ExternalValues();
        pc.setUuid(uuid);
        em.persist(pc);
        em.getTransaction().commit();
        em.clear();
    }
View Full Code Here

TOP

Related Classes of org.apache.openjpa.persistence.meta.common.apps.ExternalValues

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.