Package org.apache.openjpa.persistence

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


        // there is no special query or relation support for non-mapped
        // interfaces in OpenJPA at this time.
        OpenJPAEntityManager em = null;
        try {
            em = emf.createEntityManager();
            em.createInstance(NonMappedInterface.class);
            fail("IllegalArgumentException expected");
        } catch (IllegalArgumentException e) {} // good
        if (em != null)
            em.close();
    }
View Full Code Here


    }

    public void testCollectionInterfaces() {
        OpenJPAEntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        ManagedIface pc = em.createInstance(ManagedIface.class);
        Set set = new HashSet();
        set.add(createInstance(em, 3));
        set.add(createInstance(em, 4));
        set.add(createInstance(em, 5));
        pc.setSetI(set);
View Full Code Here

    }

    private void createMixed() {
        OpenJPAEntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        MixedInterface pc = em.createInstance(MixedInterface.class);
        pc.setIntField(4);
        em.persist(pc);
        pc = new MixedInterfaceImpl();
        pc.setIntField(4);
        em.persist(pc);
View Full Code Here

        // there is no special query or relation support for non-mapped
        // interfaces in OpenJPA at this time.
        OpenJPAEntityManager em = null;
        try {
            em = emf.createEntityManager();
            em.createInstance(NonMappedInterface.class);
            fail("IllegalArgumentException expected");
        } catch (IllegalArgumentException e) {} // good
        if (em != null)
            em.close();
    }
View Full Code Here

    }

    public void testBasicOperations() {
        OpenJPAEntityManager em = emf.createEntityManager();
        SimpleManagedInterface pc =
            em.createInstance(SimpleManagedInterface.class);
        pc.setId(17);
        pc.setString("hello!");
        em.getTransaction().begin();
        em.persist(pc);
        em.getTransaction().commit();
View Full Code Here

    }

    public void testManagedInterface() throws Exception {
        OpenJPAEntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        ManagedIface pc = em.createInstance(ManagedIface.class);
        pc.setIntFieldSup(3);
        pc.setIntField(4);
        pc.setEmbed(em.createInstance(ManagedInterfaceEmbed.class));

        pc.getEmbed().setEmbedIntField(5);
View Full Code Here

        OpenJPAEntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        ManagedIface pc = em.createInstance(ManagedIface.class);
        pc.setIntFieldSup(3);
        pc.setIntField(4);
        pc.setEmbed(em.createInstance(ManagedInterfaceEmbed.class));

        pc.getEmbed().setEmbedIntField(5);
        assertEquals(5, pc.getEmbed().getEmbedIntField());
        em.persist(pc);
        Object oid = em.getObjectId(pc);
View Full Code Here

    }

    public void testInterfaceOwner() {
        OpenJPAEntityManager em = emf.createEntityManager();
        ManagedInterfaceOwner pc = new ManagedInterfaceOwner();
        pc.setIFace(em.createInstance(ManagedInterfaceSup.class));
        pc.setEmbed(em.createInstance(ManagedInterfaceEmbed.class));
        pc.getIFace().setIntFieldSup(3);
        pc.getEmbed().setEmbedIntField(5);

        em.getTransaction().begin();
View Full Code Here

    public void testInterfaceOwner() {
        OpenJPAEntityManager em = emf.createEntityManager();
        ManagedInterfaceOwner pc = new ManagedInterfaceOwner();
        pc.setIFace(em.createInstance(ManagedInterfaceSup.class));
        pc.setEmbed(em.createInstance(ManagedInterfaceEmbed.class));
        pc.getIFace().setIntFieldSup(3);
        pc.getEmbed().setEmbedIntField(5);

        em.getTransaction().begin();
        em.persist(pc);
View Full Code Here

    }

    public void testCollection() {
        OpenJPAEntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        ManagedIface pc = em.createInstance(ManagedIface.class);
        Set set = new HashSet();
        set.add(new Integer(3));
        set.add(new Integer(4));
        set.add(new Integer(5));
        pc.setSetInteger(set);
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.