From 6303e9a753e205f16612bcd92ee7685446d849c9 Mon Sep 17 00:00:00 2001 From: David Ezzio Date: Tue, 25 Aug 2009 14:09:23 +0000 Subject: [PATCH] OpenJPA-525 : Applied Milosz Tylenda's OPENJPA-525.3.patch to trunk, after testing by Amy Yang. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@807642 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/openjpa/jdbc/sql/AbstractResult.java | 7 ++++--- .../java/org/apache/openjpa/jdbc/sql/ResultSetResult.java | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractResult.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractResult.java index 8e462238f..5f80926f4 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractResult.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractResult.java @@ -688,12 +688,12 @@ public abstract class AbstractResult 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); } @@ -834,7 +834,8 @@ public abstract class AbstractResult /** * Translate the user-given id or column. This method is called before - * delegating to any get*Internal methods. Return the + * delegating to any get*Internal methods with the exception of + * getObjectInternal. Return the * original value by default. */ protected Object translate(Object obj, Joins joins) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java index 30c2937cd..a4f8e01ca 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java @@ -357,6 +357,9 @@ public class ResultSetResult 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,8 +396,7 @@ public class ResultSetResult val = new Short(getShortInternal(obj, joins)); break; case JavaTypes.STRING: - return getStringInternal(obj, joins, - obj instanceof Column && ((Column) obj).getType() == Types.CLOB); + return getStringInternal(obj, joins, isClob); case JavaTypes.OBJECT: return _dict .getBlobObject(_rs, ((Number) obj).intValue(), _store);