Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No identifier specified for entity in java hibernate

Tags:

java

hibernate

I am using hibernate and i mapped my table with my bean. If i am not assign any particular column value as @id, it throws "No identifier specified for entity" error, however it is not primary key in my data table. I want to add multiple records with same data. how can i do it? When i annotated my product Name column with @id my code runs perfect.

like image 861
Pratik Joshi Avatar asked Mar 04 '26 08:03

Pratik Joshi


1 Answers

Hibernate requires an identifier for each entity. However, it is possible to use native queries to insert new records. And, in the same way, to recover them.

like image 109
Paul Vargas Avatar answered Mar 05 '26 22:03

Paul Vargas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!