-->
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.  [ 1 post ] 
Author Message
 Post subject: many-to-many relationship
PostPosted: Thu Jun 15, 2006 6:33 pm 
Newbie

Joined: Thu Jun 15, 2006 5:58 pm
Posts: 18
Hibernate version 3.1.3 and backend postgres8.0
I have a many-to-many relation between company and location linked by
company_location table
I have defined a set on my company.hbm.xml file
<set name="offices" batch-size = "20" outer-join="auto" cascade="save-update">
<key column="company_id"/>
<one-to-many class="CompanyLocations"/>
</set>

On my CompanyLocation.hbm.xml file (link table)
I have a many-to-one relation to office defined
<many-to-one name= "salesOffice" column="office_id" cascade="none" not-null="true" />

// java code
Object[] tmp = jlstOffices.getSelectedValues();
for(int i = 0 ; i < tmp.length ; ++i)
{
company.getOffices().add((SalesOffice)tmp[i]);
}
When I try to save the company object, I get the error shown below. I
tried debugging the program I could see my persistent set of offices but when the primary key in my linking table is accessed i get this error.
Could some one help me on this.
//hibernate3.1.3 error
ERROR - IllegalArgumentException in class: CompanyLocations, getter method of property: cid
org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of CompanyLocations.cid


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

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.