Hibernate Annotation Join table question

hibernate

Solution

A third column technically makes that table an entity, not a "jointable". So the table would need to be an entity itself. Think about it from a SQL point of view. Is a join table just a join table when it has more than just the info needed to join two other tables together?

Also as FYI, this scenario is covered in chapter 7 of "Java Persistence (JPA) with Hibernate":

You can use two common strategies to map such a structure to Java classes. The first strategy requires an intermediate entity class for the join table and is mapped with one-to-many associations. The second strategy utilizes a collection of components, with a value-type class for the join table.

Problem

When doing join table with hibernate annotation, how to i add an extra column that's not a join column, like, say married as a weak entity? like an extra column? ``` @ManyToMany(targetEntity=some.class, cascade ={CascadeType.PERSIST, CascadeType.MERGE}, fetch=FetchType.EAGER) @JoinTable(name = "RELATION", joinColumns ={ @JoinColumn(name = "HID", unique = true) }, inverseJoinColumns = { @JoinColumn(name = "FID") }) Set<PERSON> PEOPLE = new HashSet<PERSON>(); ```

Original source