Hey,
I'm having a mapping issue with a legacy database. Here's the basic model:
TransactionTreeNode
-> nodeId (PK)
-> system
-> transaction
-> ...
TransactionTranslation
-> system (PK)
-> transaction (PK)
-> language (PK)
I'm trying to map all available translations of a TransactionTreeNode. As this is not done based on PK, I guess I'll have to use a property-ref?
Note that this is a many-to-many relation, as the same system/transaction can be defined in multiple nodes
Here's the mapping I have so far for the TransactionTreeNode:
Code:
<id name="treeNodeId" type="integer">
<column name="NIDTREENODE"/>
<generator class="sequence">
<param name="sequence">NIDTREENODESEQ</param>
</generator>
</id>
<properties name="transactionRef">
<property name="system" type="string">
<column name="ISYSTVAX"/>
</property>
<property name="transaction" type="string">
<column name="RTASK"/>
</property>
</properties>
<bag name="transactionTranslationList" lazy="true" inverse="true" >
<key property-ref="transactionRef">
<column name="ISYSTVAX" />
<column name="RTASK"/>
</key>
<many-to-many class="org.test.commontypes.TransactionTranslation"
not-found="ignore"/>
</bag>
This results in following error on startup:
Code:
org.hibernate.MappingException: collection element mapping has wrong number of columns: org.test.commontypes.TransactionTreeLeaf.transactionTranslationList type: org.test.commontypes.TransactionTranslation
at org.hibernate.mapping.Collection.validate(Collection.java:263)
at org.hibernate.cfg.Configuration.validate(Configuration.java:992)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1173)
Hibernate version: 3.2.0.cr1
Any idea's what I'm doing wrong?
thanks in advance!
Sven