Commit db411bfe authored by Marco Balestri's avatar Marco Balestri
Browse files

[KNOWAGE-7082] Adds proper management of Integer and Long/Float values

parent 0aef75bd
......@@ -167,14 +167,14 @@ public class PersistedTableHelper {
if (fieldValue == null || fieldValue.toString().isEmpty()) {
insertStatement.setNull(fieldIndex + 1, java.sql.Types.FLOAT);
} else {
insertStatement.setDouble(fieldIndex + 1, (Float) fieldValue);
insertStatement.setDouble(fieldIndex + 1, ((Number) fieldValue).floatValue());
}
} else if (fieldMetaTypeName.contains("Long")) {
// only for primitive type is necessary to use setNull method if value is null
if (fieldValue == null || fieldValue.toString().isEmpty()) {
insertStatement.setNull(fieldIndex + 1, java.sql.Types.BIGINT);
} else {
insertStatement.setLong(fieldIndex + 1, (Long) fieldValue);
insertStatement.setLong(fieldIndex + 1, ((Number) fieldValue).longValue());
}
} else if (fieldMetaTypeName.contains("Boolean")) {
// only for primitive type is necessary to use setNull method if value is null
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment