diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/TestAssocOverridesXML.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/TestAssocOverridesXML.java index 3bec4ef1a..4ef3d4563 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/TestAssocOverridesXML.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/TestAssocOverridesXML.java @@ -54,19 +54,42 @@ public class TestAssocOverridesXML extends AbstractPersistenceTestCase{ "embed-persistence.xml", props); EntityManager em = emf1.createEntityManager(); + + XMLAssocOverEntityA ea = new XMLAssocOverEntityA(); + XMLAssocOverEntityB eb = new XMLAssocOverEntityB(); + XMLAssocOverEntityB meb = new XMLAssocOverEntityB(); + XMLAssocOverEmbed emb = new XMLAssocOverEmbed(); + eb.setName("XMLAssocOverEntityB"); + meb.setName("XMLAssocOverEntityBM21"); + List eaList1 = new ArrayList(); + eaList1.add(ea); + List eaList2 = new ArrayList(); + eaList2.add(ea); + eb.setEaList(eaList1); + meb.setEaList(eaList2); + emb.setName("XMLAssocOverEmbed"); + emb.setEb(eb); + emb.setMeb(meb); + List embList = new ArrayList(); + embList.add(emb); + ea.setEmbA(embList); + em.getTransaction().begin(); + em.persist(ea); em.getTransaction().commit(); em.close(); - // The above should trigger schema definition - - assertSQLFragnments(_sql, "CREATE TABLE XML_EMBALIST .*" + + try { + assertSQLFragnments(_sql, "CREATE TABLE XML_EMBALIST .*" + " .*emba_entb.*emba_mentb"); - try { - if (emf1 != null) - cleanupEMF(emf1); - } catch (Exception e) { - fail(e.getMessage()); + } + finally { + try { + if (emf1 != null) + cleanupEMF(emf1); + } catch (Exception e) { + fail(e.getMessage()); + } } } diff --git a/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml b/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml index 4aa41d8d0..dae25fa4b 100644 --- a/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml +++ b/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml @@ -50,6 +50,7 @@ org/apache/openjpa/persistence/jdbc/order/order-orm-3.xml org/apache/openjpa/persistence/inheritance/orm.xml org/apache/openjpa/persistence/orm.xml + org/apache/openjpa/persistence/embed/embed-assoc-over-orm.xml diff --git a/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/embed/embed-assoc-over-orm.xml b/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/embed/embed-assoc-over-orm.xml new file mode 100644 index 000000000..7cf2c643a --- /dev/null +++ b/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/embed/embed-assoc-over-orm.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/embed/embed-orm.xml b/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/embed/embed-orm.xml index 8ada25679..1b71f744e 100644 --- a/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/embed/embed-orm.xml +++ b/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/embed/embed-orm.xml @@ -216,36 +216,6 @@ version="2.0"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -303,21 +273,5 @@ version="2.0"> - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/embed/embed-persistence.xml b/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/embed/embed-persistence.xml index 3660f778d..0cb208bc7 100644 --- a/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/embed/embed-persistence.xml +++ b/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/embed/embed-persistence.xml @@ -21,12 +21,12 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0"> - org/apache/openjpa/persistence/embed/embed-orm.xml + org/apache/openjpa/persistence/embed/embed-assoc-over-orm.xml org.apache.openjpa.persistence.embed.attrOverrides.XMLAssocOverEmbed org.apache.openjpa.persistence.embed.attrOverrides.XMLAssocOverEntityA org.apache.openjpa.persistence.embed.attrOverrides.XMLAssocOverEntityB - +