Hibernate/JPA Ternary Relationships

After much pain and suffering trying to get ternary relationships working correctly using the JPA annotations, I finally hit upon this post. The secret sauce: it makes use of the (rather poorly documented) @CollectionOfElements Hibernate annotation to annotate the set of link objects in the primary class, and makes the link class @Embeddable. No primary key class in the link.

JPA 2.0 supposedly manages to make this cryptic nonsense, including the ability to associate additional information with a link table, much easier.


Posted

in

by

Tags:

Comments

One response to “Hibernate/JPA Ternary Relationships”

  1. Gwanggaeto Avatar
    Gwanggaeto

    I definitely agree with u. The guys could it better 😉