I'm developing a little tool with JavaFX and a PostgreSQL-database. My task now is to handle a 32 digits numeric. I tried it with Long, but its to short / small.
I remember that Postgres grumbled because I didn't use the correct datatype, that's why I'm asking here first, before I change all lines again affected by this problem.
I do not math with this numeric, but I need to save null within.
What's your advice? String, BigInteger?
Code-Example:
//...
myObject.setSerialNumber(getLongFromDB(rs, "serialnumber"));
//...
private static Long getLongFromDB(ResultSet rs, String column) throws SQLException {
Long l = rs.getLong(column);
if (rs.wasNull()) l = null; // because getLong is long not Long, I need to know about null
return l;
}
setSerialNumber? Is itlong? or is it of some other type so you are storingnull?