Hi, I have just ugraded from Hibernate 3.4 to 3.5.2.
Now @MapKey and @MapKeyManyToMany are deprecated.
But when I remove them as suggested, cause Hibernate should now be aware of generics. I receive a MappingException:
Quote:
org.hibernate.MappingException: collection index mapping has wrong number of columns: de.zew.vitax.tax.taxbase.shareholderAssetAndIncome.TaxBaseShareholderAssetOrIncome.map type: object
Code:
@Entity
@DiscriminatorValue(value = "Node")
public class TB_NodeData<K extends Enum<K>, V extends TB_BasicData> extends TB_BasicData {
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, targetEntity = TB_BasicData.class, orphanRemoval = true)
@MapKeyManyToMany(targetEntity = Enum.class)
@Fetch(value = FetchMode.SELECT)
private Map<K, V> subMap;
Quote:
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "AssetOrIncome", discriminatorType = DiscriminatorType.STRING)
public abstract class TaxBaseShareholderAssetOrIncome<K extends Enum<K>> extends TaxBaseImp {
...
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, targetEntity = TB_LeafDataShareholder.class, orphanRemoval = true)
@org.hibernate.annotations.MapKey(targetElement = Enum.class)
protected Map<K, TB_LeafDataShareholder> map;
What's wrong and how can I fix without deprecated annotations?
Sure MapKeyColumn and MapKeyJoinColumn should replace them, but I don't know how. Especially cause there is no "target" attribute any more.
Before the upgrade it worked fine and resulted in the intended schema.
Thanks.
Greetings Michael