openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dez...@apache.org
Subject svn commit: r807362 - in /openjpa/branches/1.1.x: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/
Date Mon, 24 Aug 2009 20:18:38 GMT
Author: dezzio
Date: Mon Aug 24 20:18:38 2009
New Revision: 807362

URL: http://svn.apache.org/viewvc?rev=807362&view=rev
Log:
OpenJPA-525: Applied Amy's patch   	 OPENJPA-525-3-branch1.1.x.patch .  Also merged revision
79066 at trunk that renamed misnamed test classes.

Added:
    openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/TestInputStreamLob.java
      - copied unchanged from r790666, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/TestInputStreamLob.java
    openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/TestReaderLob.java
      - copied unchanged from r790666, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/TestReaderLob.java
Removed:
    openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/InputStreamLobTest.java
    openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/ReaderLobTest.java
Modified:
    openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractResult.java
    openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java

Modified: openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractResult.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractResult.java?rev=807362&r1=807361&r2=807362&view=diff
==============================================================================
--- openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractResult.java
(original)
+++ openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractResult.java
Mon Aug 24 20:18:38 2009
@@ -30,6 +30,7 @@
 import java.sql.SQLException;
 import java.sql.Time;
 import java.sql.Timestamp;
+import java.sql.Types;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.HashMap;
@@ -666,12 +667,12 @@
 
     public Object getObject(Object obj, int metaType, Object arg)
         throws SQLException {
-        return getObjectInternal(translate(obj, null), metaType, arg, null);
+        return getObjectInternal(obj, metaType, arg, null);
     }
 
     public Object getObject(Column col, Object arg, Joins joins)
         throws SQLException {
-        return getObjectInternal(translate(col, joins), col.getJavaType(),
+        return getObjectInternal(col, col.getJavaType(),
             arg, joins);
     }
 
@@ -736,15 +737,17 @@
 
     public String getString(Object obj)
         throws SQLException {
-        return getStringInternal(translate(obj, null), null);
+        return getStringInternal(translate(obj, null), null,
+            obj instanceof Column && ((Column) obj).getType() == Types.CLOB);
     }
 
     public String getString(Column col, Joins joins)
         throws SQLException {
-        return getStringInternal(translate(col, joins), joins);
+        return getStringInternal(translate(col, joins), joins,
+            col.getType() == Types.CLOB);
     }
 
-    protected String getStringInternal(Object obj, Joins joins)
+    protected String getStringInternal(Object obj, Joins joins, boolean isClobString)
         throws SQLException {
         Object val = checkNull(getObjectInternal(obj, JavaTypes.STRING,
             null, joins));
@@ -810,7 +813,8 @@
 
     /**
      * Translate the user-given id or column. This method is called before
-     * delegating to any <code>get*Internal</code> methods. Return the
+     * delegating to any <code>get*Internal</code> methods with the exception
of
+     * <code>getObjectInternal</code>. Return the
      * original value by default.
      */
     protected Object translate(Object obj, Joins joins)

Modified: openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java?rev=807362&r1=807361&r2=807362&view=diff
==============================================================================
--- openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java
(original)
+++ openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java
Mon Aug 24 20:18:38 2009
@@ -357,6 +357,9 @@
         if (metaTypeCode == -1 && obj instanceof Column)
             metaTypeCode = ((Column) obj).getJavaType();
 
+        boolean isClob = (obj instanceof Column) ? ((Column) obj).getType() == Types.CLOB
: false;
+        obj = translate(obj, joins);
+        
         Object val = null;
         switch (metaTypeCode) {
             case JavaTypes.BOOLEAN:
@@ -393,7 +396,7 @@
                 val = new Short(getShortInternal(obj, joins));
                 break;
             case JavaTypes.STRING:
-                return getStringInternal(obj, joins);
+                return getStringInternal(obj, joins, isClob);
             case JavaTypes.OBJECT:
                 return _dict
                     .getBlobObject(_rs, ((Number) obj).intValue(), _store);
@@ -462,10 +465,11 @@
         return _dict.getShort(_rs, ((Number) obj).intValue());
     }
 
-    protected String getStringInternal(Object obj, Joins joins)
+    protected String getStringInternal(Object obj, Joins joins, boolean isClobString)
         throws SQLException {
-        if (obj instanceof Column && ((Column) obj).getType() == Types.CLOB)
-            return _dict.getClobString(_rs, findObject(obj, joins));
+        if (isClobString) {
+            return _dict.getClobString(_rs, ((Number) obj).intValue());
+        }
         return _dict.getString(_rs, ((Number) obj).intValue());
     }
 
@@ -489,9 +493,6 @@
         throws SQLException {
         if (obj instanceof Number)
             return obj;
-        // getStringInternal will take care the translation
-        if (obj instanceof Column && ((Column) obj).getType() == Types.CLOB)
-        	return obj;
         return Numbers.valueOf(findObject(obj, joins));
     }
 



Mime
View raw message