openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hthom...@apache.org
Subject svn commit: r1485010 - in /openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence: common/apps/PartPK.java inheritance/jointable/onetomany/TestMapsIdWithAutoGeneratedKey.java
Date Tue, 21 May 2013 23:23:32 GMT
Author: hthomann
Date: Tue May 21 23:23:32 2013
New Revision: 1485010

URL: http://svn.apache.org/r1485010
Log:
OPENJPA-2373: Made a test case update given identity auto generated ids do not work so well
for some databases.

Modified:
    openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/apps/PartPK.java
    openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/jointable/onetomany/TestMapsIdWithAutoGeneratedKey.java

Modified: openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/apps/PartPK.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/apps/PartPK.java?rev=1485010&r1=1485009&r2=1485010&view=diff
==============================================================================
--- openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/apps/PartPK.java
(original)
+++ openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/apps/PartPK.java
Tue May 21 23:23:32 2013
@@ -26,11 +26,11 @@ import javax.persistence.Embeddable;
 public class PartPK implements Serializable {
     /*Textile Id*/
 
-    @Column(name="ID_TXE", length=4)
+    @Column(name="ID_TXE")
     private Integer textileId;
 
     /*Part Number*/
-    @Column(name="NU_PT", length=4)
+    @Column(name="NU_PT")
     private Integer partNumber;
 
     public PartPK() {

Modified: openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/jointable/onetomany/TestMapsIdWithAutoGeneratedKey.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/jointable/onetomany/TestMapsIdWithAutoGeneratedKey.java?rev=1485010&r1=1485009&r2=1485010&view=diff
==============================================================================
--- openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/jointable/onetomany/TestMapsIdWithAutoGeneratedKey.java
(original)
+++ openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/jointable/onetomany/TestMapsIdWithAutoGeneratedKey.java
Tue May 21 23:23:32 2013
@@ -19,10 +19,19 @@
 package org.apache.openjpa.persistence.inheritance.jointable.onetomany;
 
 
-import javax.naming.NamingException;
+import java.io.IOException;
+import java.sql.SQLException;
+
 import javax.persistence.EntityManager;
 import javax.persistence.EntityTransaction;
 
+import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
+import org.apache.openjpa.jdbc.meta.MappingTool;
+import org.apache.openjpa.jdbc.meta.MappingTool.Flags;
+import org.apache.openjpa.jdbc.sql.DBDictionary;
+import org.apache.openjpa.jdbc.sql.OracleDictionary;
+import org.apache.openjpa.jdbc.sql.SQLServerDictionary;
+import org.apache.openjpa.jdbc.sql.SybaseDictionary;
 import org.apache.openjpa.persistence.common.apps.Part;
 import org.apache.openjpa.persistence.common.apps.PartPK;
 import org.apache.openjpa.persistence.common.apps.Shirt;
@@ -62,15 +71,31 @@ import org.apache.openjpa.persistence.te
  *
  */
 public class TestMapsIdWithAutoGeneratedKey extends SingleEMFTestCase {
+    boolean disabled = false;
+    
     public void setUp() {
         super.setUp(DROP_TABLES, 
         	Textile.class, TextilePK.class,
         	Shirt.class, Trousers.class,
         	Part.class, PartPK.class);
+        
+        DBDictionary dic = ((JDBCConfiguration)emf.getConfiguration()).getDBDictionaryInstance();
+        if (!dic.supportsAutoAssign) {
+            disabled = true;
+            return;
+        }
+        if (dic instanceof SQLServerDictionary || dic instanceof OracleDictionary || dic
instanceof SybaseDictionary) {
+            disabled = true;
+            return;
+        }
     }
 
 
-    public void testPersistShirtWithPart() throws NamingException {
+    public void testPersistShirtWithPart() {
+        if (disabled) {
+            return;
+        }
+        
         EntityManager em = emf.createEntityManager();
         EntityTransaction tx = em.getTransaction();
         int nPart = 3;



Mime
View raw message