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 with entityclass (StackOverflowError)
PostPosted: Sun Jun 01, 2008 2:01 pm 
Newbie

Joined: Mon May 12, 2008 12:16 pm
Posts: 7
I have got many-to-many relation in Part, Labour with PartsLabour as entity Class. I am able to save the relation for PartsLabour but when i retreive them for Part or Labour classes, I get the StackOverflowError. I cant figure it out, Any suggestion; Below are the mapping file and code;

Labour.hbm.xml
---------------------

<set
name="partSet"
inverse="true">
<key column="LABOUR_ID" />
<one-to-many class="com.wonder.common.PartsLabour" />
</set>

Parts.hbm.xml
------------------
<set
name="labourSet"
inverse="true">
<key column="PART_ID" />
<one-to-many class="com.wonder.common.PartsLabour" />
</set>

PartsLabour.hbm.xml
---------------------------
<many-to-one
name="part"
column="PART_ID"
not-null="true" />

<many-to-one
name="labour"
column="LABOUR_ID"
not-null="true" />

Unit Test
-----------
Session session = HibernateUtils.createNewSessionAndTransaction();

part = partsDAO.findById(1274L, false);
labour = labourDAO.findById(1416L, false);

partLabour.setPart(part);
partLabour.setLabour(labour);
partLabour.setPricePerUnit(5.25F);
partLabour.setDateStarted(Utilities.getCurrentTime().toString());
partLabour.setQuantity(200);
partLabour.setStatus("In Progress");

part.getLabourSet().add(partLabour);
labour.getPartSet().add(partLabour);

partLabourDAO.makePersistent(partLabour);

//Getting the Stack-Overflow error here.
// System.out.println("alpha:" + part);
// System.out.println("beta:" + labour);

HibernateUtils.commitTransaction(session);


I have seen one of the known Bugs (http://opensource.atlassian.com/projects/hibernate/browse/HHH-2277), Is it related to my problem as well.

I am bit new to the technology if there is anything on my side please suggest.

_________________
Thanks in Advance
Kashif


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.