-->
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.  [ 3 posts ] 
Author Message
 Post subject: Collection is empty
PostPosted: Wed Jul 08, 2009 1:05 am 
Newbie

Joined: Thu Aug 07, 2008 3:41 pm
Posts: 14
Hello,

I have some trouble understanding how hibernate works.
I've got a one-to-many relationship like Person has one or more Phones.
So I create a Person object and set an Collection of Phones to it.
After persisting this with entityManager.persist, the Person is in the DB, and the Phones also.
Ok, nice, now here is my problem, after retrieving the Person the Collection Phones is always empty.
But getting the Phones through a query does return a result. Why does the Person object (retrieved from the Query) have no Phones?
I have Cascade.PERSIST setup. What am I missing here?

Thanks!


Top
 Profile  
 
 Post subject: Re: Collection is empty
PostPosted: Wed Jul 08, 2009 5:30 am 
Newbie

Joined: Tue Jun 02, 2009 4:06 am
Posts: 16
Hi

Could you please attach your hbm.xml file so that i can look into the attributes which you have set while performing one-many mapping.

Thanks
Kartik


Top
 Profile  
 
 Post subject: Re: Collection is empty
PostPosted: Wed Jul 08, 2009 5:32 am 
Newbie

Joined: Thu Aug 07, 2008 3:41 pm
Posts: 14
I already fixed it, I didnt have the mapping file correct.
Thanks anyway.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.