brettwooldridge / HikariCP

光 HikariCP・A solid, high-performance, JDBC connection pool at last.
Apache License 2.0
19.91k stars 2.92k forks source link

Return `null` when applicable from `getGeneratedKeys` #2180

Open elpete opened 7 months ago

elpete commented 7 months ago

Currently, there is no way to check if getGeneratedKeys returned null. Instead, when trying to call ResultSet.next() a NullPointerException is thrown.

This method should return an empty ResultSet when there are no generated keys, but not all JDBC drivers do (like Apache Derby) In these cases, I think the safest option is to return null, which can then be checked (and is checked in popular JDBC libraries like JOOQ.)