I'm trying to specify a (only unidirectional right now) manytoany association, but I'm not able to make hibernate build a join table with a type column.
The class structure is like this
Code:
A(abstract)
| \
B C(abstract)
| \
D E
This is the annotation I am using for the manytoany association from B to C
Code:
@org.hibernate.annotations.ManyToAny(fetch = FetchType.EAGER, metaColumn = @Column(name = "C_Type"))
@org.hibernate.annotations.AnyMetaDef(idType = "string", metaType = "string", metaValues = {})
@JoinTable(name = "BtoC", joinColumns = @JoinColumn(name = "B_id"), inverseJoinColumns = @JoinColumn(name = "C_id"))
AFAIK I should get a join table "BtoC" with three columns:
Code:
B_id, C_id, C_Type
Instead the join table only contains:
Code:
B_id, C_id
This is with the TABLE_PER_CLASS and the JOINED InheritanceType. In case of TABLE_PER_CLASS it uses the unions to determine the "any"-end of the association instead of creating and using the "C_Type" column. What am I doing wrong?