Hibernate HSQL Inspection - Warning with "SELECT LAST_INSERT_ID()"


We have a DAO object with Hibernate. I cannot get rid of a warning regrading LAST_INSERT_ID () being an unknown database function. It would be very nice to be able to get rid of this warning. At run time, it is not causing any functional issue. Just the annoying warning.  Perhaps, this type of use-case can be addressed differently. If that's the case I also welcome the alternate way (actually I am not sure if we even need this -- would not storing the data return the id anyway?

int accountId = insert.executeUpdate();
BigInteger lastId = (BigInteger) entityManager.createNativeQuery("SELECT LAST_INSERT_ID()")

IntelliJ Ultimate: 2017.2.3
MySQL Drive: 5.1.40 via the "Data Source and Drivers" config screen.

1 comment
Comment actions Permalink


You can either

- disable the SQL | Unresolved reference inspection in Inspection settings 

- suppress it for the statement

- if you do have this function in remote MySQL database, add the Data Source to that database in the project and introspect(synchronize) the database schema where this function is defined - so youy could see it in Database tool window. Then select this schema to be used for SQL resolve by default for this source file in SQL Resolution Scopes settings.


Please sign in to leave a comment.