Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:3.0
Problem description
In our project we are planning to use Hibernate as an ORM tool. While deciding mapping strategies for the class associations we are facing issues in some places. These issues are mentioned below
Mapping a class which has two interfaces and one of the interfaces is associated with another class
We have class Q1 and Q2 inheriting from class P.
Class Z1 and Z2 inheriting from interface X.
There is a n:1 bidirectional association between P to X.
Also class Z1 implements another interface Y.
Ideally we would like to map X and Y as two interfaces of class Z1 and keep reference of X in the mapping of class P. But Hibernate does not allow doing that.
The solution to tackle this issue
Treat the above association as association between P and Z1 and P and Z2. So in the class P we need to put attributes of Z1 and Z2 instead of X. But if the number of subclasses of X is fairly large then immediate the structure of class P becomes complicated.
We are curious to know whether there are any more efficient ways to implement the scenario mentioned above using Hibernate.