Package org.apache.openjpa.persistence

Examples of org.apache.openjpa.persistence.OpenJPAEntityManager.detach()


    public void testDetachCopy() {
        OpenJPAEntityManager em = emf.createEntityManager();
        LRSEntity lrs = em.find(LRSEntity.class, id);
        assertLRS(lrs, "lrs");
        lrs = em.detach(lrs);
        assertEquals("lrs", lrs.getName());
        assertNull(lrs.getLRSList());
        em.close();
        assertMerge(lrs);
    }
View Full Code Here


        em.getTransaction().commit();
        em.close();

        em = emf.createEntityManager();
        ManagedIface pcx = em.find(ManagedIface.class, oid);
        pc = em.detach(pcx);
        em.close();

        assertTrue(em.isDetached(pc));
        pc.setIntField(7);
View Full Code Here

        OpenJPAEntityManager pm = getPM();
        AttachB b = pm.find(AttachB.class, oid);

        assertNotNull("b is null in testDetach", b);

        b = (AttachB) pm.detach(b);
        endEm(pm);

        assertTrue(pm.isDetached(b));
        assertEquals(5, b.getAint());
        assertEquals("5", b.getBstr());
View Full Code Here

        pm.getFetchPlan().addFetchGroup("all");
        AttachB b = pm.find(AttachB.class, oid);

        assertNotNull("b is null in testDetachWithGroups", b);

        b = (AttachB) pm.detach(b);
        endEm(pm);

        assertTrue(pm.isDetached(b));
        assertEquals("b.getAint() not 5", 5, b.getAint());
        assertEquals("b.getAint() not 5str", "5", b.getBstr());
View Full Code Here

    }

    public void testDetachNoOverwrite() {
        OpenJPAEntityManager pm = getPM();
        AttachB b = (AttachB) pm.find(AttachB.class, oid);
        b = (AttachB) pm.detach(b);
        endEm(pm);

        b.setBstr("12");

        pm = getPM();
View Full Code Here

        OpenJPAEntityManager pm = getPM();
        AttachB b = (AttachB) pm.find(AttachB.class, oid);

        assertNotNull("b is null in testOptimisticLock", b);

        b = (AttachB) pm.detach(b);
        endEm(pm);

        b.setAint(12);
        b.setBstr("12");
        TreeMap map = new TreeMap();
View Full Code Here

        AttachD d = pm.find(AttachD.class, doid);

        assertNotNull("d is null in testEmbedded", d);

        d.getEmbeddedE().getEstr();
        d = (AttachD) pm.detach(d);
        endEm(pm);

        d.getEmbeddedE().setEstr("E12");
        pm = getPM();
        startTx(pm);
View Full Code Here

        OpenJPAEntityManager pm = getPM();
        AttachD d = (AttachD) pm.find(AttachD.class, doid);

        assertNotNull("d is null in testNullEmbedded", d);
        d.getEmbeddedE().getEstr();
        d = (AttachD) pm.detach(d);
        endEm(pm);

        d.setEmbeddedE(null);
        pm = getPM();
        startTx(pm);
View Full Code Here

        AttachD d = (AttachD) pm.find(AttachD.class, doid);

        assertNotNull("d is null in testNullEmbeddedRelated", d);

        d.getEmbeddedE().getEstr();
        d = (AttachD) pm.detach(d);
        endEm(pm);

        d.getEmbeddedE().setEstr(null);
        pm = getPM();
        startTx(pm);
View Full Code Here

    public void testNullCollection() {
        OpenJPAEntityManager pm = getPM();
        AttachB b = (AttachB) pm.find(AttachB.class, oid);
        b.getDs();
        b = (AttachB) pm.detach(b);
        endEm(pm);

        assertEquals(1, b.getDs().size());
        b.setDs(null);
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.