Hi,
how should I map the following collection:
Code:
@CollectionOfElements
@Type(type = "com.alcatel.rose.model.hibernate.ULDLValueIntegerType")
@Columns(columns = {@Column(name = "ulcel"), @Column(name = "dlcel")})
@Cascade(value = org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
@MapKeyManyToMany
public Map<ChannelType, ULDLValueInteger> getCeElements()
ChannelType is annotated with @Entity and ULDLValueInteger is persisted using a hibernate UserType. When persisted, a ULDLValueInteger, it uses 2 columns in the database.
Code:
public class ULDLValueInteger {
private Integer ul;
private Integer dl;
.......
}
Using the above annotations I get an exception:
Code:
Caused by: org.hibernate.MappingException: collection index mapping has wrong number of columns: com.alcatel.rose.model.NodeBType.ceElements type: com.alcatel.rose.model.hibernate.ULDLValueIntegerType
at org.hibernate.mapping.IndexedCollection.validate(IndexedCollection.java:69)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1030)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1211)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:688)
Any help is highly appreciated.