-->
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: Empty lazy loaded collection set to NULL;NullPointerExceptin
PostPosted: Sun Oct 31, 2004 12:41 pm 
Newbie

Joined: Thu Oct 21, 2004 7:02 am
Posts: 14
Hi
When trying to add the first object to a lazy loaded collection (Set/HashSet) I get a NullPointerException. It seems that Hibernate sets my HashSet = null when I do a myObject.getCollection(). I expect an empty HashSet, not null. So the NullPointerException comes when I try adding the object:
myObject.getCollection().add(newObject);

Aynone got any idea about this? I've seen several examples adding objects to lazy loaded collections like this.

Thanks,
Kristian


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 31, 2004 12:49 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Use your debugger. This is almost certainly your code which results in the null, not Hibernate.

And don't post here again without giving sufficient information for someone to be able to help you. Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 31, 2004 12:51 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
PS. Check equals() / hashCode(), getters / setters, etc.


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.