Package org.apache.openjpa.persistence

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


    public void testManagedInterfaceAndBase() {
        OpenJPAEntityManager em = emf.createEntityManager();

        // Add some entities
        em.getTransaction().begin();
        ManagedIface2 mif2 = em.createInstance(ManagedIface2.class);
        mif2.setIntFieldSup(12);
               
        SubclassF scf = new SubclassF();
        scf.setClassFName("SubclassFName");
        scf.setIntFieldSup(13);
View Full Code Here


    public void testManagedInterface() {
        OpenJPAEntityManager em = emf.createEntityManager();

        // Add some entities
        em.getTransaction().begin();
        ManagedIface mif = em.createInstance(ManagedIface.class);
        mif.setIntFieldSup(10);
               
        ImplClassA ica = new ImplClassA();
        ica.setImplClassAName("ImplClassAName");
        ica.setIntFieldSup(11);
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

    }

    public void testCollectionPC() {
        OpenJPAEntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        ManagedIface pc = em.createInstance(ManagedIface.class);
        Set set = new HashSet();
        set.add(new SimpleEntity("a", "3"));
        set.add(new SimpleEntity("b", "4"));
        set.add(new SimpleEntity("c", "5"));
        pc.setSetPC(set);
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

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.