I want one of my Composite key elements to be auto incremented and I am using Embedded Key for my entity class and therefore I am not able to use the Generated Values Annotation to solve the problem since @GeneratedValue annotation is ignored when using @Embeddable or @EmbeddedId.
You cannot use @GeneratedValue with @EmbeddedId, @Embeddable or @IdClass, the @GeneratedValue annotation gets ignored.
You have to manually assign the values.
Check the following references :
https://java.net/jira/browse/GLASSFISH-13567
https://forums.hibernate.org/viewtopic.php?p=2393944&sid=57b20ef2c7de6f6bcba632130987bc22
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With