diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2008-04-14 04:18:55 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2008-04-14 04:18:55 +0000 |
commit | 68aec4c2495be067a555fd8de9ffddedfb857f05 (patch) | |
tree | 0c666b9c99b13bbf0b225af92edd923b686e824e /src/main/java/com/amazon | |
parent | 63ff050e4d48f8b997905e9e0a11d944ea6038a6 (diff) |
Fix code generation bug with nullable column.
Diffstat (limited to 'src/main/java/com/amazon')
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.
*
|