openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awh...@apache.org
Subject svn commit: r520522 - in /incubator/openjpa/trunk: openjpa-kernel/src/main/java/org/apache/openjpa/enhance/ openjpa-kernel/src/main/java/org/apache/openjpa/util/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/ open...
Date Tue, 20 Mar 2007 19:00:46 GMT
Author: awhite
Date: Tue Mar 20 12:00:38 2007
New Revision: 520522

URL: http://svn.apache.org/viewvc?view=rev&rev=520522
Log:
OPENJPA-132 : Fix bugs with using a field of type java.sql.Date/Time/Timestamp 
as a single-field identity primary key.  Replaced "generationtype" test package
with "identity" test package and moved old identity generation tests to new
package, along with new test for java.sql.Date id fields.


Added:
    incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/
    incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/IdentityGenerationType.java
      - copied, changed from r520057, incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/IdentityGenerationType.java
    incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestGenerationType.java
      - copied, changed from r520057, incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestGenerationType.java
Removed:
    incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/IdentityGenerationType.java
    incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestGenerationType.java
Modified:
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java?view=diff&rev=520522&r1=520521&r2=520522
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
(original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
Tue Mar 20 12:00:38 2007
@@ -1826,6 +1826,11 @@
                             Object.class, null);
                         if (!fieldManager && type != Object.class)
                             code.checkcast().setType(fmds[i].getDeclaredType());
+                    } else if (oidType == DateId.class) {
+                        code.invokevirtual().setMethod(oidType, "getId",
+                            Date.class, null);
+                        if (!fieldManager && type != Date.class)
+                            code.checkcast().setType(fmds[i].getDeclaredType());
                     } else {
                         code.invokevirtual().setMethod(oidType, "getId", 
                             unwrapped, null);
@@ -2023,6 +2028,8 @@
                 addExtractObjectIdFieldValueCode(code, pk);
             if (_meta.getObjectIdType() == ObjectId.class)
                 args = new Class[]{ Class.class, Object.class };
+            else if (_meta.getObjectIdType() == Date.class)
+                args = new Class[]{ Class.class, Date.class };
             else
                 args = new Class[]{ Class.class, pk.getObjectIdFieldType() };
         }

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java?view=diff&rev=520522&r1=520521&r2=520522
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java
(original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java
Tue Mar 20 12:00:38 2007
@@ -241,6 +241,9 @@
                 case JavaTypes.OBJECT:
                     return new ObjectId(cls, koid.getIdObject(), 
                         koid.hasSubclasses());
+                case JavaTypes.DATE:
+                    return new DateId(cls, ((DateId) oid).getId(),
+                        koid.hasSubclasses());
                 default:
                     throw new InternalException();
             }

Copied: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/IdentityGenerationType.java
(from r520057, incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/IdentityGenerationType.java)
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/IdentityGenerationType.java?view=diff&rev=520522&p1=incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/IdentityGenerationType.java&r1=520057&p2=incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/IdentityGenerationType.java&r2=520522
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/IdentityGenerationType.java
(original)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/IdentityGenerationType.java
Tue Mar 20 12:00:38 2007
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.openjpa.persistence.generationtype;
+package org.apache.openjpa.persistence.identity;
 
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;

Copied: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestGenerationType.java
(from r520057, incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestGenerationType.java)
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestGenerationType.java?view=diff&rev=520522&p1=incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestGenerationType.java&r1=520057&p2=incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestGenerationType.java&r2=520522
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestGenerationType.java
(original)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestGenerationType.java
Tue Mar 20 12:00:38 2007
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.openjpa.persistence.generationtype;
+package org.apache.openjpa.persistence.identity;
 
 import java.util.HashMap;
 import java.util.List;



Mime
View raw message