I have the following problem I'd like to map to my objects using hibernate:
DB-Scheme:
Code:
Table Product
ID
Title
Category
Table ProductDescription
ID
KEY
Name
Description
Language
Table Product_ProductDescription (Crosstable)
Product.ID
ProductDescription.KEY
The special Thing is the ProductDescription.Key. I'll use it to identify the Descriptions which contain to the same product (but in different languages). So the combination of 'Key' and 'Language' is always unique.
Is it possible to map it to objects like:
Code:
class ProductDescription {...<nothing fancy> }
class Product {
@Id
long ID;
String title;
@what comes here??
ProductDescription description; // only one descriptione as it is always used together with language
I could map ProductDescription using a Collection and a ManyToMany mapping. But then I have to many information in my objects which I will never use.
Or should I use the ManyToMany mapping and remove the not used descriptions before use?
I'm interested in your comments
best regards
Daniel