Getting Boolean from ResultSet

Priv picture Priv · Sep 18, 2016 · Viewed 12.1k times · Source

ResultSet#getBoolean seems to return false when it's null.
Is there an easy way to get a Boolean (not boolean) from a ResultSet?

Answer

uoyilmaz picture uoyilmaz · Sep 18, 2016

You can call wasNull after calling getBoolean. It's explained here: https://docs.oracle.com/javase/7/docs/api/java/sql/ResultSet.html#wasNull%28%29