Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

org.hibernate.HibernateException: The database returned no natively generated identity value

I think it means you're trying to use the IDENTITY ID generator with a table column which is not properly configured. It should be an auto_increment column for the IDENTITY generator to work. Else, the database doesn't return any generated ID.


We must auto_increment the id column of the table by using below query

ALTER TABLE document MODIFY COLUMN document_id INT auto_increment

And fixing this is as simple as making sure that the Primary Key Column, of the table you are working with, has Auto Increment set.


While creating Table in Database you may have forgot to give Autoincrement to that particular column.

Or

You forgot to annotate in Java class as "Generated Value"

This will work fine