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
This commit is contained in:
David Ezzio 2009-08-25 14:09:23 +00:00
parent 9a4406038e
commit 6303e9a753
2 changed files with 8 additions and 5 deletions

View File

@ -688,12 +688,12 @@ public abstract class AbstractResult
public Object getObject(Object obj, int metaType, Object arg) public Object getObject(Object obj, int metaType, Object arg)
throws SQLException { 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) public Object getObject(Column col, Object arg, Joins joins)
throws SQLException { throws SQLException {
return getObjectInternal(translate(col, joins), col.getJavaType(), return getObjectInternal(col, col.getJavaType(),
arg, joins); arg, joins);
} }
@ -834,7 +834,8 @@ public abstract class AbstractResult
/** /**
* Translate the user-given id or column. This method is called before * 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. * original value by default.
*/ */
protected Object translate(Object obj, Joins joins) protected Object translate(Object obj, Joins joins)

View File

@ -357,6 +357,9 @@ public class ResultSetResult
if (metaTypeCode == -1 && obj instanceof Column) if (metaTypeCode == -1 && obj instanceof Column)
metaTypeCode = ((Column) obj).getJavaType(); metaTypeCode = ((Column) obj).getJavaType();
boolean isClob = (obj instanceof Column) ? ((Column) obj).getType() == Types.CLOB : false;
obj = translate(obj, joins);
Object val = null; Object val = null;
switch (metaTypeCode) { switch (metaTypeCode) {
case JavaTypes.BOOLEAN: case JavaTypes.BOOLEAN:
@ -393,8 +396,7 @@ public class ResultSetResult
val = new Short(getShortInternal(obj, joins)); val = new Short(getShortInternal(obj, joins));
break; break;
case JavaTypes.STRING: case JavaTypes.STRING:
return getStringInternal(obj, joins, return getStringInternal(obj, joins, isClob);
obj instanceof Column && ((Column) obj).getType() == Types.CLOB);
case JavaTypes.OBJECT: case JavaTypes.OBJECT:
return _dict return _dict
.getBlobObject(_rs, ((Number) obj).intValue(), _store); .getBlobObject(_rs, ((Number) obj).intValue(), _store);