Reputation: 380
I've a test case, that have three tables/classes (Language, Caption and CaptionLanguage).
The Language table stores the languages data.
The Caption table stores the caption index data.
The CaptionLanguage table stores the caption data per language.
Which Inheritance type I can use to solve the problem?
If I set the "@DiscriminatorColumn(name="ID_LANG",discriminatorType=DiscriminatorType.Integer)",
with the "@Inheritance(strategy=InheritanceType.JOINED)", will work?
Without use the @DiscriminatorValue(value="Value")
Thanks!
Upvotes: 0
Views: 287
Reputation: 42114
This does not look like issue that could be solved by inheritance. Despite name, CaptionLanguage
is not subtype of Language
- it is also not subtype of Caption
.
Instead it looks like three entities with following characteristic:
Language
to CaptionLanguage
(and/or many-to-one inverse)Caption
to CaptionLanguage
(and/or possibly many-to-one inverse)Caption
to parent Caption
(and/or one-to-many inverse)CaptionLanguage
does have composite primary key, so @IdClass, or @EmbeddedId should be used.Upvotes: 1