Reputation: 49
I am working on spring 4.0
and hibernate 4.0.1
project in eclipse and using oracle as database. If I make some changes in database then changes will not affect by eclipse. Eg. I generate id in oracle this code is successfully executed in eclipse. But after that I again make some changes in database same code is not running it gives me error as
org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save():
Please help me to solve this problem.
Upvotes: 3
Views: 1131
Reputation: 2068
The meaning of your exception is id have not setted correctly.The error is in your mapping.If your are using sequence
for incrementing id you must also do this in mapping.Try following:
@GeneratedValue(generator = "yourSequenceName", strategy=GenerationType.SEQUENCE)
private int id;
I hope this will help you.
Upvotes: 1