Sunday, August 21, 2016

HIBERNATE: MANY TO MANY MAPPING

Simplest way is by marking the associated members by @ManyToMany and the rest is taken care of.






The objects must be attached to their counterpart's arraylist as seen in the screenshot.





This however created a redundant schema. One table is completely unnecessary here.!!!





So this can be removed by putting mappedBy inside one of the classes of one's choice.





And now the resultant schema will have one table less than before, thanks to mappedBy.




No comments:

Post a Comment