Examples of IncompleteRelationshipSubclass


Examples of org.apache.openjpa.persistence.relations.entity.IncompleteRelationshipSubclass

                    "openjpa.jdbc.QuerySQLCache", "true");
    }

    public void testIncompleteRelationship() {
        final EntityManager em = emf.createEntityManager();
        IncompleteRelationshipSubclass parent = null;
        IncompleteRelationshipChildEntity child = null;

        em.getTransaction().begin();
        for (String s : DISCOUNTS) {
            child = new IncompleteRelationshipChildEntity(s, CLIENT_ID);
            em.persist(child);
        }
        em.getTransaction().commit();

        for (int i = 1; i < 100; i++) {
            em.getTransaction().begin();

            parent = new IncompleteRelationshipSubclass(i, CLIENT_ID);
//            parent.setChild(child);

            em.persist(parent);
            em.getTransaction().commit();

            parent = (IncompleteRelationshipSubclass)
                    em.createQuery("SELECT i "+
                                   "FROM IncompleteRelationshipSubclass i "+
                                   "WHERE   i.pk.id = :id "+
                                   "AND     i.pk.clientId = :clientId ")
              .setParameter("id", i)
              .setParameter("clientId", CLIENT_ID)
              .getSingleResult();

            assertEquals(parent.getPk().getId(), i);
            assertNull(parent.getChild());
        }
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.relations.entity.IncompleteRelationshipSubclass

                    "openjpa.jdbc.QuerySQLCache", "true");
    }

    public void testIncompleteRelationship() {
        final EntityManager em = emf.createEntityManager();
        IncompleteRelationshipSubclass parent = null;
        IncompleteRelationshipChildEntity child = null;

        em.getTransaction().begin();
        for (String s : DISCOUNTS) {
            child = new IncompleteRelationshipChildEntity(s, CLIENT_ID);
            em.persist(child);
        }
        em.getTransaction().commit();

        for (int i = 1; i < 2; i++) {
            em.getTransaction().begin();

            parent = new IncompleteRelationshipSubclass(i, CLIENT_ID);

            em.persist(parent);
            em.getTransaction().commit();

            parent = (IncompleteRelationshipSubclass)
                    em.createQuery("SELECT i "+
                                   "FROM IncompleteRelationshipSubclass i "+
                                   "WHERE   i.pk.id = :id "+
                                   "AND     i.pk.clientId = :clientId ")
              .setParameter("id", i)
              .setParameter("clientId", CLIENT_ID)
              .getSingleResult();

            assertEquals(parent.getPk().getId(), i);
            assertNull(parent.getChild());
        }
    }
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.