diff options
Diffstat (limited to 'src')
3 files changed, 14 insertions, 1 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java index 1abe8d8..933817e 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java @@ -1898,7 +1898,7 @@ class JDBCStorableGenerator<S extends Storable> { TypeDesc resultSetType = TypeDesc.forClass(resultSetGetMethod.getReturnType());
Label wasNull = b.createLabel();
- if (resultSetType.isPrimitive() && property.isNullable()) {
+ if (resultSetType.isPrimitive() && property.isColumnNullable()) {
b.loadLocal(rsVar);
b.invokeInterface
(TypeDesc.forClass(ResultSet.class), "wasNull", TypeDesc.BOOLEAN, null);
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableIntrospector.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableIntrospector.java index a2d9181..d14818a 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableIntrospector.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableIntrospector.java @@ -1125,6 +1125,7 @@ public class JDBCStorableIntrospector extends StorableIntrospector { private final String mColumnName;
private final Integer mDataType;
private final String mDataTypeName;
+ private final boolean mColumnNullable;
private final Method mResultSetGet;
private final Method mPreparedStatementSet;
private final StorablePropertyAdapter mAdapter;
@@ -1151,6 +1152,7 @@ public class JDBCStorableIntrospector extends StorableIntrospector { mColumnName = columnInfo.columnName;
mDataType = columnInfo.dataType;
mDataTypeName = columnInfo.dataTypeName;
+ mColumnNullable = columnInfo.nullable;
mResultSetGet = resultSetGet;
mPreparedStatementSet = preparedStatementSet;
mAdapter = adapter;
@@ -1166,6 +1168,7 @@ public class JDBCStorableIntrospector extends StorableIntrospector { mColumnName = null;
mDataType = null;
mDataTypeName = null;
+ mColumnNullable = false;
mResultSetGet = null;
mPreparedStatementSet = null;
mAdapter = null;
@@ -1325,6 +1328,10 @@ public class JDBCStorableIntrospector extends StorableIntrospector { return mDataTypeName;
}
+ public boolean isColumnNullable() {
+ return mColumnNullable;
+ }
+
public Method getResultSetGetMethod() {
return mResultSetGet;
}
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableProperty.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableProperty.java index bbaf5fb..5e4c94f 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableProperty.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableProperty.java @@ -75,6 +75,12 @@ public interface JDBCStorableProperty<S extends Storable> extends StorableProper String getDataTypeName();
/**
+ * @return true if column is nullable
+ * @since 1.2
+ */
+ boolean isColumnNullable();
+
+ /**
* Returns the method to use to access this property (by index) from a
* ResultSet.
*
|