How to represent a 3-way relation with JPA?
Posted
by simpatico
on Stack Overflow
See other posts from Stack Overflow
or by simpatico
Published on 2010-05-22T18:53:39Z
Indexed on
2010/05/22
19:00 UTC
Read the original article
Hit count: 190
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.
© Stack Overflow or respective owner