openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hthom...@apache.org
Subject svn commit: r1533289 - in /openjpa/trunk: ./ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/jointable/onetomany/ openjpa-persistence-jdbc/src/test/java/o...
Date Thu, 17 Oct 2013 23:28:31 GMT
Author: hthomann
Date: Thu Oct 17 23:28:31 2013
New Revision: 1533289

URL: http://svn.apache.org/r1533289
Log:
OPENJPA-2435: Version field in a projection always returned as an Integer.  Merged 2.1.x changes
to trunk.

Added:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/version/type/
      - copied from r1533280, openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/version/type/
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/version/type/BaseEntity.java
      - copied unchanged from r1533280, openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/version/type/BaseEntity.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/version/type/ChildVersionEntity.java
      - copied unchanged from r1533280, openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/version/type/ChildVersionEntity.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/version/type/LongVersionEntity.java
      - copied unchanged from r1533280, openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/version/type/LongVersionEntity.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/version/type/PrimativeLongVersionEntity.java
      - copied unchanged from r1533280, openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/version/type/PrimativeLongVersionEntity.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/version/type/PrimativeShortVersionEntity.java
      - copied unchanged from r1533280, openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/version/type/PrimativeShortVersionEntity.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/version/type/ShortVersionEntity.java
      - copied unchanged from r1533280, openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/version/type/ShortVersionEntity.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/version/type/TestVersionFieldType.java
      - copied unchanged from r1533280, openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/version/type/TestVersionFieldType.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/version/type/TimestampVersionEntity.java
      - copied unchanged from r1533280, openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/version/type/TimestampVersionEntity.java
Modified:
    openjpa/trunk/   (props changed)
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/NumberVersionStrategy.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/jointable/onetomany/
  (props changed)

Propchange: openjpa/trunk/
------------------------------------------------------------------------------
  Merged /openjpa/branches/2.1.x:r1533280

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/NumberVersionStrategy.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/NumberVersionStrategy.java?rev=1533289&r1=1533288&r2=1533289&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/NumberVersionStrategy.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/NumberVersionStrategy.java
Thu Oct 17 23:28:31 2013
@@ -18,12 +18,12 @@
  */
 package org.apache.openjpa.jdbc.meta.strats;
 
-import java.util.Map;
 import java.util.HashMap;
+import java.util.Map;
 
-import org.apache.openjpa.meta.JavaTypes;
-import org.apache.openjpa.util.InternalException;
+import org.apache.openjpa.jdbc.meta.FieldMapping;
 import org.apache.openjpa.jdbc.schema.Column;
+import org.apache.openjpa.meta.JavaTypes;
 
 /**
  * Uses a version number for optimistic versioning.
@@ -36,7 +36,8 @@ public class NumberVersionStrategy
     public static final String ALIAS = "version-number";
 
     private Number _initial = 1;
-
+    private Integer _javaType = null;
+    
     /**
      * Set the initial value for version column. Defaults to 1.
      */
@@ -56,7 +57,13 @@ public class NumberVersionStrategy
     }
 
     protected int getJavaType() {
-        return JavaTypes.INT;
+        if (_javaType == null && vers.getClassMapping().getVersionFieldMapping()
!= null) {
+            _javaType = Integer.valueOf(vers.getClassMapping().getVersionFieldMapping().getTypeCode());
+        } else {
+            return JavaTypes.INT;
+        }
+
+        return _javaType;
     }
     
     protected Object nextVersion(Object version) {

Propchange: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/jointable/onetomany/
------------------------------------------------------------------------------
  Merged /openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/jointable/onetomany:r1533280



Mime
View raw message