-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: mapping many-to-many on property-ref?
PostPosted: Thu Nov 04, 2010 6:14 am 
Newbie

Joined: Thu Mar 22, 2007 10:39 am
Posts: 14
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


Top
 Profile  
 
 Post subject: Re: mapping many-to-many on property-ref?
PostPosted: Mon Nov 08, 2010 11:26 am 
Newbie

Joined: Thu Mar 22, 2007 10:39 am
Posts: 14
No ideas? I tried several different configurations with this. Also tried working with formula's but no luck.

As I don't have much experience with collection mapping in Hibernate, I still hope I'm not seeing an obvious mistake..

thanks,

Sven


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.