When I first learnt using Hibernate, I implemented the M-N as two 1-N relations with the relation table as if a separate ordinary class. It works fine, so far.
I also found that there is another approach suggested in the tip & tricks of this site to implement the relation class as a composite element of the class ...
My questions are:
Do I have to built the composite elements (along with the same class name) on both side of the relation?
What differences (in comparing the two 1-N with composite element) would it made to the system, in terms of performance and difficulty on maintaining data?
When should a composite element be used?
|