Package org.apache.openjpa.persistence

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


    public void testUpdate2() {
        OpenJPAEntityManager em =
            (OpenJPAEntityManager) currentEntityManager();
        startTx(em);

        RuntimeTest1 run = em.find(RuntimeTest1.class, em.getObjectId(runt1));
        assertNotNull(run);
        assertEquals("runt1", run.getStringField());
        assertNotNull(run.getSelfOneOne());

        String ejbqlUpdate = "UPDATE RuntimeTest1 x " +
View Full Code Here


        endTx(em);

        em = (OpenJPAEntityManager) currentEntityManager();
        startTx(em);

        RuntimeTest1 inst = em.find(RuntimeTest1.class, em.getObjectId(runt1));
        em.refresh(inst);

        assertNotNull(inst);
        assertEquals("upd", inst.getStringField());
View Full Code Here

    public void testDelete1() {
        OpenJPAEntityManager em =
            (OpenJPAEntityManager) currentEntityManager();
        startTx(em);

        RuntimeTest1 run = em.find(RuntimeTest1.class, em.getObjectId(runt1));
        assertNotNull(run);
        assertEquals("runt1", run.getStringField());
        assertNotNull(run.getSelfOneOne());

        String ejbdelUpdate = "DELETE  FROM RuntimeTest1 s " +
View Full Code Here

            .setParameter("strngfld", "runt1")
            .executeUpdate();

        assertEquals(1, delEntity);

        RuntimeTest1 del = em.find(RuntimeTest1.class, em.getObjectId(runt1));
        assertNull(del);

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

    public void testDelete2() {
        OpenJPAEntityManager em =
            (OpenJPAEntityManager) currentEntityManager();
        startTx(em);

        RuntimeTest1 run = em.find(RuntimeTest1.class, em.getObjectId(runt1));
        assertNotNull(run);
        assertEquals("runt1", run.getStringField());
        assertNotNull(run.getSelfOneOne());

        String ejbdelUpdate =
View Full Code Here

    public void testUpdate3() {
        OpenJPAEntityManager em =
            (OpenJPAEntityManager) currentEntityManager();
        startTx(em);

        Entity1 ent = em.find(Entity1.class, 23);

        assertNotNull(ent);
        assertEquals("UPDATEST", ent.getStringField());

        int upd = em.createQuery(
View Full Code Here

        Object oid = em.getObjectId(pc);
        em.getTransaction().commit();
        em.close();

        em = emf.createEntityManager();
        pc = em.find(ManagedIface.class, oid);
        assertEquals(3, pc.getIntFieldSup());
        assertEquals(4, pc.getIntField());
        assertEquals(5, pc.getEmbed().getEmbedIntField());
        em.getTransaction().begin();
        pc.setIntField(14);
View Full Code Here

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

        em = emf.createEntityManager();
        try {
            assertNull(em.find(ManagedIface.class, oid));
        } catch (EntityNotFoundException onfe) {}

        em.close();
    }
View Full Code Here

        em.getTransaction().begin();
        em.persist(pc);
        Object oid = em.getObjectId(pc);
        em.getTransaction().commit();
        pc = em.find(ManagedInterfaceOwner.class, oid);
        assertEquals(3, pc.getIFace().getIntFieldSup());
        assertEquals(5, pc.getEmbed().getEmbedIntField());
        em.close();

        em = emf.createEntityManager();
View Full Code Here

        assertEquals(3, pc.getIFace().getIntFieldSup());
        assertEquals(5, pc.getEmbed().getEmbedIntField());
        em.close();

        em = emf.createEntityManager();
        pc = em.find(ManagedInterfaceOwner.class, oid);
        assertEquals(3, pc.getIFace().getIntFieldSup());
        assertEquals(5, pc.getEmbed().getEmbedIntField());
        em.close();

        em = emf.createEntityManager();
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.