How to model this strange, reflexive, self referencing relationship
At first I though this was a design flaw on my end (as my [previous post|http://forums.sun.com/thread.jspa?threadID=5399766&tstart=15] shows), but now I'm pretty sure it's more complicated than that.
Here's the thing (simplified):
A user U1 has friends U2, U3 and U4, who are also users. This automatically means that users U2, U3 and U4 are friends with U1 (a reflexive relationship), and there are no additional rows mapping this. The join table, called FRIENDS, has an additional field - the date when the users became friends (so it looks like this: userId1, userId2, date).
Is it possible to model this in JPA so that the user entity has a list of friends? If yes, please try to explain how as this is mind boggling to me.
Is it maybe possible to modify the SQL for fetching relationship fields?
Thanks!