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);