Retrieve the last inserted ID.
Note, there are some restrictions to the following dialects:
- {@link SQLDialect#DB2} doesn't support this
- {@link SQLDialect#ORACLE} doesn't support this
- {@link SQLDialect#POSTGRES} doesn't support this
- {@link SQLDialect#SQLITE} supports this, but its support is poorlydocumented.
@return The last inserted ID. This may be
null
in somedialects, if no such number is available.
@throws DataAccessException if something went wrong executing the query