-->
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 strangeness
PostPosted: Thu Oct 16, 2003 5:43 pm 
Regular
Regular

Joined: Wed Oct 15, 2003 4:40 pm
Posts: 67
Hello,

I have a class with a non-lazy list of child items. When I fetch the data from the DB, I can access the parent properties just fine but there is something strange with the child list. I have two rows in the database and the log says

total objects hydrated: 2
...
collection fully initialized
1 collections initialized


However, when fetch the child list size(), says that it contains 3 items and even more strange, if I try to iterate over it, I get a NPE even from trying to do a getClass().getName() on the first item.

Or have I misunderstood something?

Thanks in advance,
Nik


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 16, 2003 10:25 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Is it mapped as a List? If so sounds like your indexes may be staring from 1 instead of zero, in which case Hibernate would insert a null element in the first List position.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 17, 2003 1:40 am 
Regular
Regular

Joined: Wed Oct 15, 2003 4:40 pm
Posts: 67
steve wrote:
Is it mapped as a List? If so sounds like your indexes may be staring from 1 instead of zero, in which case Hibernate would insert a null element in the first List position.


Aah, thanks, that was it. The path of Hibernate is full of traps for the careless noob :-)


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.