How to check the zero value for a double that is taken from the database

I am retrieving values ​​from a database. I am extracting a double value from a database using

ResultSet rs = ....;
while(...){
  rs.getDouble("num");
}

How to check if rs.getDouble ("num") is null. Since the value is stored as (MySQL) double, and I want to save it in my JVM as a double, I cannot just use! = Null.

Which is the easiest way. Converts a value to Double () and then makes .equals (null) the easiest / best (in your opinion) way?

+3
source share
2 answers

Test rs.wasNull () after rs.getDouble ().

+11
source

, javadoc , 0, . wasNull() ( ), 0; , 0 null.

0

Source: https://habr.com/ru/post/1761349/


All Articles