How to use an auto-generating id and composite key for same entity using @IdClass?
I created a composite key using @IdClass that I want to specify that those fields make the unique key fo the record. However, I also want to add an auto-generating id (sequence generator). Is it possible to have the auto-incrementing id separate from the composite key? I used @Id for both in my entity and it's complaing id (sequence auto-gen) is not part of the composite key. Is it okay to define in composite key then but not use it for finding and matching records that is inclusive of that id?
1 Reply
⌛
This post has been reserved for your question.
Hey @Kale Vivi! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.