Hello,
I own the first edition of this book, and on pages 311-313 there are ternary associations described:
From a Category's perspective, this is an association that maps Items to Users:
@ManyToMany
@org.hibernate.annotations.MapKeyManyToMany(
joinColumns = @JoinColumn(name = "ITEM_ID")
)
@JoinTable(
name = "CATEGORY_ITEM",
joinColumns = @JoinColumn(name = "CATEGORY_ID"),
inverseJoinColumns = @JoinColumn(name = "USER_ID")
)
private Map<Item,User> itemsAndUser = new HashMap<Item,User>();
Now, you gave the reader an exercise to make it bidirectional.
I tried several ways but without luck.
Can you reveal us how it's done ?
Thanks a lot for a great book!
|