Forums Register Login

JPA: Joined Table ID of subclass

+Pie Number of slices to send: Send
Hi everyone,

How do I override the column name of the ID of my subclass entity? Say the superclass Parent is mapped to table "parent" and its id is mapped to column "id", then I have this subclass called Child mapped to table "child" having its id mapped to column "id". I want my subclass Child to get its id mapped to column "child_id" instead. Is this even possible? Is it defined in the JPA spec? I've been reading and scanning the spec and I can't seem to find it there or probably I'm must missing it.

Using AttributeOverride(s) has no effect at all.

Thanks!
1
+Pie Number of slices to send: Send
You use @PrimaryKeyJoinColumn for this.


+Pie Number of slices to send: Send
Thanks! That solved it
Get me the mayor's office! I need to tell her about this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1636 times.
Similar Threads
Bind a whole class in jsp?
can you have one-to-many join without using identifier column?
JPA, one to many and serialization
Hibernate - Using subclass and joined-subclass element
Mapping Question
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 05:02:34.