openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1538480 - in /openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence: TestOpenJPA2330.java criteria/Course.java entity/EntityA.java entity/EntityB.java
Date Mon, 04 Nov 2013 00:00:42 GMT
Author: struberg
Date: Mon Nov  4 00:00:42 2013
New Revision: 1538480

URL: http://svn.apache.org/r1538480
Log:
OPENJPA-2335 add a unit test for demonstrating the bug

Modified:
    openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestOpenJPA2330.java
    openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Course.java
    openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/entity/EntityA.java
    openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/entity/EntityB.java

Modified: openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestOpenJPA2330.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestOpenJPA2330.java?rev=1538480&r1=1538479&r2=1538480&view=diff
==============================================================================
--- openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestOpenJPA2330.java
(original)
+++ openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestOpenJPA2330.java
Mon Nov  4 00:00:42 2013
@@ -21,11 +21,14 @@ package org.apache.openjpa.persistence;
 import javax.persistence.EntityManager;
 import javax.persistence.spi.LoadState;
 
+import junit.framework.Assert;
 import org.apache.openjpa.persistence.entity.EntityA;
 import org.apache.openjpa.persistence.entity.EntityB;
 import org.apache.openjpa.persistence.entity.EntityC;
 import org.apache.openjpa.persistence.test.SingleEMFTestCase;
 
+import java.util.Iterator;
+
 /**
  *
  */
@@ -55,4 +58,21 @@ public class TestOpenJPA2330 extends Sin
 
         em.close();
     }
+
+    public void testOpenJPA2335() {
+        EntityManager em = emf.createEntityManager();
+
+        em.getTransaction().begin();
+        EntityA a = new EntityA();
+        EntityB b1 = new EntityB(a);
+        EntityB b2 = new EntityB(a);
+        a.getBs().add(b1);
+        a.getBs().add(b2);
+
+        em.persist(a);
+
+        em.getTransaction().commit();
+        em.close();
+
+    }
 }

Modified: openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Course.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Course.java?rev=1538480&r1=1538479&r2=1538480&view=diff
==============================================================================
--- openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Course.java
(original)
+++ openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Course.java
Mon Nov  4 00:00:42 2013
@@ -29,7 +29,6 @@ import javax.persistence.Table;
 
 @Entity
 @Table(name="CR_CRSE")
-
 public class Course {
     @Id
     @GeneratedValue

Modified: openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/entity/EntityA.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/entity/EntityA.java?rev=1538480&r1=1538479&r2=1538480&view=diff
==============================================================================
--- openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/entity/EntityA.java
(original)
+++ openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/entity/EntityA.java
Mon Nov  4 00:00:42 2013
@@ -42,7 +42,7 @@ public class EntityA implements Serializ
     private String name;
 
     @OneToMany(fetch = FetchType.EAGER, mappedBy = "center", orphanRemoval = true, cascade
= CascadeType.ALL)
-    @OrderColumn
+    @OrderColumn(name="POSITION")
     private Set<EntityB> services = new LinkedHashSet<EntityB>();
 
     public EntityA() {

Modified: openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/entity/EntityB.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/entity/EntityB.java?rev=1538480&r1=1538479&r2=1538480&view=diff
==============================================================================
--- openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/entity/EntityB.java
(original)
+++ openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/entity/EntityB.java
Mon Nov  4 00:00:42 2013
@@ -22,6 +22,7 @@ import java.util.HashSet;
 import java.util.Set;
 
 import javax.persistence.CascadeType;
+import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.FetchType;
 import javax.persistence.GeneratedValue;
@@ -47,6 +48,10 @@ public class EntityB {
     @OrderColumn
     private Set<EntityC> linacs;
 
+    @Column(name = "POSITION")
+    private int position;
+
+
     public EntityB() {
     }
 



Mime
View raw message