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

Examples of org.apache.openjpa.persistence.kernel.common.apps.ModRuntimeTest2


            return;

        OpenJPAEntityManager pm = getPM(false, true);
        startTx(pm);

        ModRuntimeTest2 b = pm.find(ModRuntimeTest2.class, _id);
        assertTest2Orig(b);
        changeTest2(b);

        endTx(pm);
View Full Code Here


            return;

        OpenJPAEntityManager pm = getPM(false, true);
        startTx(pm);

        ModRuntimeTest2 b = pm.find(ModRuntimeTest2.class, _id);
        assertTest2Orig(b);
        changeTest2(b);

        rollbackTx(pm);
View Full Code Here

            return;

        OpenJPAEntityManager pm = getPM(false, true);
        startTx(pm);

        ModRuntimeTest2 b = pm.find(ModRuntimeTest2.class, _id);
        ModRuntimeTest1 parent = b.getSelfOneOne();
        assertNotNull("parent is null", parent);
        pm.remove(b);

        endTx(pm);

        // parent should be valid
        assertEquals("PARENT", parent.getStringField());

        // 'b' should be cleared
        assertNull(b.getStringField());
        assertEquals(0, b.getIntField());
        assertNull(b.getSelfOneOne());
    }
View Full Code Here

            return;

        OpenJPAEntityManager pm = getPM(false, true);
        startTx(pm);

        ModRuntimeTest2 b = pm.find(ModRuntimeTest2.class, _id);
        pm.remove(b);

        rollbackTx(pm);

        assertTest2Orig(b);
View Full Code Here

    public void testTransientStateTransitions1()
        throws Exception {
        if (!supportsPessimistic)
            return;

        ModRuntimeTest2 b = createTest2();

        OpenJPAEntityManager pm = getPM(false, false);
        startTx(pm);

        pm.transactional(b, true);
        pm.transactional(b.getSelfOneOne(), true);
        changeTest2(b);

        rollbackTx(pm);

        assertTest2Orig(b);
View Full Code Here

    public void testTransientStateTransitions2()
        throws Exception {
        if (!supportsPessimistic)
            return;

        ModRuntimeTest2 b = createTest2();

        OpenJPAEntityManager pm = getPM(false, false);
        startTx(pm);

        pm.transactional(b, true);
        pm.transactional(b.getSelfOneOne(), true);
        changeTest2(b);

        endTx(pm);

        assertTest2Changed(b, false);
View Full Code Here

    public void testTransientStateTransitions3()
        throws Exception {
        if (!supportsPessimistic)
            return;

        ModRuntimeTest2 b = createTest2();

        OpenJPAEntityManager pm = getPM(false, false);
        startTx(pm);
        pm.persist(b);
        int oid = b.getId();
        endTx(pm);
        endEm(pm);

        pm = getPM(false, false);
        //FIXME jthomas
        b = pm.find(ModRuntimeTest2.class, oid);
        pm.retrieve(b);
        //FIXME jthomas
        endEm(pm);

        // note that at this point, parent is not transient, just retrieved.
        assertNotNull("b is null", b.getSelfOneOne());
    }
View Full Code Here

    private ModRuntimeTest2 createTest2() {
        return createTest2("NAME", 50);
    }

    private ModRuntimeTest2 createTest2(String str, int i) {
        return createTest2(new ModRuntimeTest2(str, i));
    }
View Full Code Here

        }

        OpenJPAEntityManager pm = getPM();
        startTx(pm);

        ModRuntimeTest2 b = createTest2();
        pm.persist(b);
        _id = b.getId();

        endTx(pm);
        endEm(pm);
    }
View Full Code Here

    public void testFlagTransitions1()
        throws Exception {
        if (!supportsPessimistic)
            return;

        ModRuntimeTest2 b = createTest2();
        assertTransient(b);
        assertTransient(b.getSelfOneOne());

        OpenJPAEntityManager pm = getPM(false, false);
        startTx(pm);
        pm.persist(b);

        assertPersistent(b, true, true, false, true);

        rollbackTx(pm);

        assertTransient(b);
        assertTransient(b.getSelfOneOne());
        endEm(pm);
    }
View Full Code Here

TOP

Related Classes of org.apache.openjpa.persistence.kernel.common.apps.ModRuntimeTest2

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.