Hello,
I am having troubles to map this relationship from my database in hibernate.
I have one table (grandchild) with products.
I have a second table (child) with productgroups. Every productgroup contains 1 or more products.
I have a third table (parent) which are contracts. A contract can reference either a product group or a product (or neither one).
The database schema is an existing productive environment, i can't change it.
I use Hibernate 3.2 with annotations.
I did a lot of research but i couldn't find anything, maybe because im not searching for the correct terms. Any help would be appreciated.
Thanks
PS: I let hibernate auto-generate my classes, It made a relationship from parent to grandchild and from grandchild to child. This works fine for all cases where the contract references a product (including product group). The only problem i have is when the contract references just a product group without a specific product.
|