How to represent a 3-way relation with JPA?
- by simpatico
A user may have several labels, and links. Then, a user associates a label (or more) to a link. How does one represent the later relationship?
A solution could be a many-to-many relationship btw user and link with the optional attribute label. http://en.wikibooks.org/wiki/Java_Persistence/ManyToMany#Mapping_a_Join_Table_with_Additional_Columns
In this case the relationship btw user and label may better be 'virtual'.
Any alternative I'm not seeing?
PS: I've used google bookmarks terminology, as it matches my case quite well.