I am trying to setup a ManyToAny association like so:
Code:
@ManyToAny(fetch = FetchType.EAGER, metaColumn = @Column(name = "Other_targetType"))
@Cascade( value = { org.hibernate.annotations.CascadeType.ALL } )
@AnyMetaDef(idType = "string", metaType = "string", metaValues = {})
@JoinTable(name = "AA_Objekt_istTeilVon")
public java.util.Set<B> getB() {
return b;
}
The Proplem is that Hibernate seems to ignore the statement and use plain old ManyToMany.
The abstract class B is on top of a large inheritance hieararchy with the TABLE_PER_CLASS strategy.
If we use ManyToMany for this association the resulting SQL statement to retrieve an associated object of class B is very large.
That's why we want to use ManyToAny to circumvent the union of all of B's subclasses.
When we use ManyToMany and ManyToAny we get a join table with two id columns.
We would like to have another column "Other_targetType" to eleminate the huge union.
Do you have any ideas?
Thanks,
Tim