-->
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.  [ 4 posts ] 
Author Message
 Post subject: Question on Collection
PostPosted: Tue Jun 19, 2007 9:00 am 
Beginner
Beginner

Joined: Sat Dec 03, 2005 11:12 am
Posts: 27
Hi,

I am using Hibernate 3.1 version.
Is it possible that hibernate can return a collection in which some of the elements are null?

I am experiencing a strange problem. I have one-to-many relationship between A and B and when I do A.getB() hibernate is giving me a collection of B. Hibernate is returning a collection with expected results but also with one null element in the collection.

Why is it inserting a null element in the collection. What is causing this? How can I avoid this.

Thanks,
csr


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 19, 2007 9:50 am 
Senior
Senior

Joined: Tue Jun 12, 2007 4:49 pm
Posts: 127
Location: India
Which collection are you using ??

Is it an ordered collection like list?

If so then its possible. Hibernate tries to find all elements starting with order 0 till the max in the list, any elements with the index between 0 and max not found are set to null.

Regards,
Jitendra


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 19, 2007 10:19 am 
Beginner
Beginner

Joined: Sat Dec 03, 2005 11:12 am
Posts: 27
Thanks Jits your post was helpful.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 19, 2007 10:25 am 
Beginner
Beginner

Joined: Sat Dec 03, 2005 11:12 am
Posts: 27
i made a mistake with the order no.


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