Hi,
I am trying to model a friendship relation between User entities. My initial impression was that this should be modeled as a bidirectional m:n relation, much like a parent-child self-reference. But in this case, the roles on both sides of the relation are the same.
In the database schema, I have a join table that basically consists of (user1_id, user2_id). How can I map this relation in the user class so the friends set of a user contains all friends, no matter in which column the user's id is?
In general, are there other ways of accomplishing this in the relational schema? (Although in this case, unfortunately, I have to deal with a legacy schema...)
Thanks,
Michael
Sorry for posting twice... this one can be deleted...
|