Consider the below example:
I have 3 tables: Fruit, Orange and Apple
id is generated in fruit table and is the primary key here
id is also primary key for Orange and Apple (shared primary key)
So for e.g. if id in fruit is 1, 2, 3, 4, 5 -- then scenario could be 1, 2 are Orange, 3, 4 are Apple and 5 is again Orange..
So Orange table will have id 1,2,5 while Apple table will have id 3, 4
===================================
Fruit
===================================
id | shape
===================================
1 | round
2 | round
3 | oblong
4 | oblong
5 | round
===================================
===================================
Orange
===================================
id | color | taste
===================================
1 | orange | sour
2 | orange | sour
5 | orange | sour
===================================
===================================
Apple
===================================
id | density | weight
===================================
1 | hard | 200
2 | hard | 220
5 | hard | 230
===================================
Issue: How to create entity classes capturing relationshipd also with only JPA annotations (I don't want to use hibernate generatedValue annotation).
If such annotation is possible with pure JPA then please guide me towards it.
Nik