summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorSabine Heider2013-02-28 07:07:19 (EST)
committer tware2013-03-19 13:52:09 (EDT)
commit76f7daceb5f4663178da4539d6cd95bb2b70e16f (patch)
tree2dc65d135b79116e0b5c6ef87a9aabf240a82aef
parent7abebd22f0b592e4f870c09326c6bde1ad4cedb4 (diff)
downloadeclipselink.runtime-76f7daceb5f4663178da4539d6cd95bb2b70e16f.zip
eclipselink.runtime-76f7daceb5f4663178da4539d6cd95bb2b70e16f.tar.gz
eclipselink.runtime-76f7daceb5f4663178da4539d6cd95bb2b70e16f.tar.bz2
Fix handling of JDBC types NCHAR, NVARCHAR and LONGNVARCHAR
The JDBC types NCHAR, NVARCHAR and LONGNVARCHAR have been introduced with JDBC 4 (i.e. Java SE 6 ). Regarding programming logic, they should be treated as their non-unicode counterparts CHAR, VARCHAR and LONGVARCHAR. I added the new datatypes to the programming logic where needed. See bug 402516. Signed-off-by: Sabine Heider <sabine.heider@sap.com>
-rw-r--r--foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/databaseaccess/DatabaseAccessor.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/databaseaccess/DatabaseAccessor.java b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/databaseaccess/DatabaseAccessor.java
index 3a99589..f0d7b4b 100644
--- a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/databaseaccess/DatabaseAccessor.java
+++ b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/databaseaccess/DatabaseAccessor.java
@@ -1336,11 +1336,11 @@ public class DatabaseAccessor extends DatasourceAccessor {
protected Object getObjectThroughOptimizedDataConversion(ResultSet resultSet, DatabaseField field, int type, int columnNumber, DatabasePlatform platform, AbstractSession session) throws SQLException {
Object value = this;// Means no optimization, need to distinguish from null.
Class fieldType = field.type;
- if ((type == Types.VARCHAR) || (type == Types.CHAR)) {
+ if ((type == Types.VARCHAR) || (type == Types.CHAR) || type == Types.NVARCHAR || type == Types.NCHAR) {
// CUSTOM PATCH for oracle drivers because they don't respond to getObject() when using scrolling result sets.
// Chars may require blanks to be trimmed.
value = resultSet.getString(columnNumber);
- if ((type == Types.CHAR) && (value != null) && platform.shouldTrimStrings()) {
+ if ((type == Types.CHAR || type == Types.NCHAR) && (value != null) && platform.shouldTrimStrings()) {
value = Helper.rightTrimString((String)value);
}
return value;
@@ -1811,7 +1811,7 @@ public class DatabaseAccessor extends DatasourceAccessor {
* Return if the JDBC type is a large character type such as clob.
*/
private boolean isClob(int type) {
- return (type == Types.CLOB) || (type == Types.LONGVARCHAR) || (type == DatabasePlatform.Types_NCLOB);
+ return (type == Types.CLOB) || (type == Types.LONGVARCHAR) || (type == DatabasePlatform.Types_NCLOB) || (type == Types.LONGNVARCHAR);
}
/**