I want to fetch the last inserted value\'s id in Hibernate.
After search:
Long lastId = ((Long) session.createSQLQuery(\"SELECT LAST_INSERT_ID()\").
Error is pretty clear. It's returning BigInteger and not long
long
You have to assign it to a BigInteger. And get longValue() from it.