openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mik...@apache.org
Subject svn commit: r584350 - in /openjpa/branches/1.0.x: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/
Date Sat, 13 Oct 2007 00:36:04 GMT
Author: mikedd
Date: Fri Oct 12 17:35:12 2007
New Revision: 584350

URL: http://svn.apache.org/viewvc?rev=584350&view=rev
Log:
OPENJPA-399 Committing Teresa's patch

Removed:
    openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/DogId.java
Modified:
    openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/LocalConstraint.java
    openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/Dog1.java
    openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/Dog2.java
    openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/DogTable.java
    openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/DogTable2.java
    openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java

Modified: openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/LocalConstraint.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/LocalConstraint.java?rev=584350&r1=584349&r2=584350&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/LocalConstraint.java
(original)
+++ openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/LocalConstraint.java
Fri Oct 12 17:35:12 2007
@@ -93,6 +93,11 @@
      * Add a column to the constraint.
      */
     public void addColumn(Column col) {
+    	if (col == null)
+            throw new InvalidStateException(_loc.get("table-mismatch",
+                col == null ? null : col.getTable(),
+                col == null ? null : getTable()));
+    	
         if (_colList == null)
             _colList = new ArrayList(3);
         else if (_colList.contains(col))

Modified: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/Dog1.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/Dog1.java?rev=584350&r1=584349&r2=584350&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/Dog1.java
(original)
+++ openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/Dog1.java
Fri Oct 12 17:35:12 2007
@@ -25,8 +25,7 @@
  * Extension of Animal class illustrating inheritance.
  */
 @Entity(name = "Dog1")
-@Table(name = "DOGTAB", schema = "SCHEMA1")
-@IdClass(DogId.class)
+@Table(name = "DOGAUTO", schema = "SCHEMA1")
 public class Dog1 implements Serializable
 
 {
@@ -34,9 +33,6 @@
     @GeneratedValue(strategy = GenerationType.AUTO)
     private int id2;
 
-    @Id
-    private int datastoreid;
-
     private String name;
 
     private float price;
@@ -86,11 +82,4 @@
         this.domestic = domestic;
     }
 
-    public int getDatastoreid() {
-        return datastoreid;
-    }
-
-    public void setDatastoreid(int datastoreid) {
-        this.datastoreid = datastoreid;
-    }
 }

Modified: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/Dog2.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/Dog2.java?rev=584350&r1=584349&r2=584350&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/Dog2.java
(original)
+++ openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/Dog2.java
Fri Oct 12 17:35:12 2007
@@ -25,8 +25,7 @@
  * Extension of Animal class illustrating inheritance.
  */
 @Entity(name = "Dog2")
-@Table(name = "DOGTAB", schema = "SCHEMA2")
-@IdClass(DogId.class)
+@Table(name = "DOGAUTO", schema = "SCHEMA2")
 public class Dog2 implements Serializable
 
 {
@@ -34,9 +33,6 @@
     @GeneratedValue(strategy = GenerationType.AUTO)
     private int id2;
 
-    @Id
-    private int datastoreid;
-
     private String name;
 
     private float price;
@@ -86,11 +82,4 @@
         this.domestic = domestic;
     }
 
-    public int getDatastoreid() {
-        return datastoreid;
-    }
-
-    public void setDatastoreid(int datastoreid) {
-        this.datastoreid = datastoreid;
-    }
 }

Modified: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/DogTable.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/DogTable.java?rev=584350&r1=584349&r2=584350&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/DogTable.java
(original)
+++ openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/DogTable.java
Fri Oct 12 17:35:12 2007
@@ -26,8 +26,7 @@
  * Extension of Animal class illustrating inheritance.
  */
 @Entity(name = "DogTable")
-@Table(name = "DOGTABLE", schema = "SCHEMA1")
-@IdClass(DogId.class)
+@Table(name = "DOGTABLES", schema = "SCHEMA1")
 public class DogTable implements Serializable
 
 {
@@ -38,9 +37,6 @@
     @GeneratedValue(strategy = GenerationType.TABLE, generator = "Dog_Gen1")
     private int id2;
 
-    @Id
-    private int datastoreid;
-
     private String name;
 
     private float price;
@@ -53,7 +49,6 @@
     }
 
     public DogTable(String name) {
-        this.id2 = id2;
         this.name = name;
 
     }
@@ -91,11 +86,4 @@
         this.domestic = domestic;
     }
 
-    public int getDatastoreid() {
-        return datastoreid;
-    }
-
-    public void setDatastoreid(int datastoreid) {
-        this.datastoreid = datastoreid;
-    }
 }

Modified: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/DogTable2.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/DogTable2.java?rev=584350&r1=584349&r2=584350&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/DogTable2.java
(original)
+++ openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/DogTable2.java
Fri Oct 12 17:35:12 2007
@@ -25,8 +25,7 @@
  * Extension of Animal class illustrating inheritance.
  */
 @Entity(name = "DogTable2")
-@Table(name = "DOGTABLE", schema = "SCHEMA2")
-@IdClass(DogId.class)
+@Table(name = "DOGTABLES", schema = "SCHEMA2")
 public class DogTable2 implements Serializable
 
 {
@@ -37,9 +36,6 @@
     @GeneratedValue(strategy = GenerationType.TABLE, generator = "Dog_Gen2")
     private int id2;
 
-    @Id
-    private int datastoreid;
-
     private String name;
 
     private float price;
@@ -52,7 +48,6 @@
     }
 
     public DogTable2(String name) {
-        this.id2 = id2;
         this.name = name;
 
     }
@@ -88,13 +83,5 @@
 
     public void setDomestic(boolean domestic) {
         this.domestic = domestic;
-    }
-
-    public int getDatastoreid() {
-        return datastoreid;
-    }
-
-    public void setDatastoreid(int datastoreid) {
-        this.datastoreid = datastoreid;
     }
 }

Modified: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java?rev=584350&r1=584349&r2=584350&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java
(original)
+++ openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java
Fri Oct 12 17:35:12 2007
@@ -83,31 +83,29 @@
 
         Dog1 dog1 = new Dog1();
         dog1.setName("helloDog1");
-        dog1.setDatastoreid(12);
         dog1.setPrice(12000);
 
         em.persist(dog1);
         Dog1 dog1a = new Dog1();
         dog1a.setName("helloDog2");
-        dog1a.setDatastoreid(15);
         dog1a.setPrice(22000);
         em.persist(dog1a);
         // add dog2
         Dog2 dog2 = new Dog2();
         dog2.setName("helloDog3");
-        dog2.setDatastoreid(12);
         dog2.setPrice(15000);
         em.persist(dog2);
 
         Dog2 dog2a = new Dog2();
         dog2a.setName("helloDog4");
-        dog2a.setDatastoreid(19);
         dog2a.setPrice(25000);
         em.persist(dog2a);
         em.getTransaction().commit();
-        // System.out.println("persist dogs are done");
 
         Dog1 dog1x = em.find(Dog1.class, kem.getObjectId(dog1));
+        // Derby can't guarantee the order of the generated value, therefore,
+        // we can't assert the id based on the order. For db2, we see the id 
+        // value in the right order
         assertTrue(dog1x.getId2() == 1 || dog1x.getId2() == 2);
         assertEquals(dog1x.getName(), "helloDog1");
         dog1x.setName("Dog1");
@@ -162,25 +160,21 @@
 
         DogTable dog1 = new DogTable();
         dog1.setName("helloDog1");
-        dog1.setDatastoreid(12);
         dog1.setPrice(12000);
 
         em.persist(dog1);
         DogTable dog1a = new DogTable();
         dog1a.setName("helloDog2");
-        dog1a.setDatastoreid(15);
         dog1a.setPrice(22000);
         em.persist(dog1a);
         // add dog2
         DogTable2 dog2 = new DogTable2();
         dog2.setName("helloDog3");
-        dog2.setDatastoreid(12);
         dog2.setPrice(15000);
         em.persist(dog2);
 
         DogTable2 dog2a = new DogTable2();
         dog2a.setName("helloDog4");
-        dog2a.setDatastoreid(19);
         dog2a.setPrice(25000);
         em.persist(dog2a);
         em.getTransaction().commit();



Mime
View raw message