-->
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: new in 2.1beta5: NullPointerException
PostPosted: Thu Oct 30, 2003 9:17 pm 
Beginner
Beginner

Joined: Wed Aug 27, 2003 4:17 pm
Posts: 27
Location: California, USA
Hibernate 2.1beta5 validates not-null properties more thoroughly. For example, an application test case (which passed with 2.1beta4) fails thus:
Code:
java.lang.NullPointerException: not-null property references a null or transient value: manager
at net.sf.hibernate.impl.SessionImpl.nullifyTransientReferences([Ljava.lang.Object;[Lnet.sf.hibernate.type.Type;ZLjava.lang.Object;[Z[Ljava.lang.String;)V(SessionImpl.java:900)
at net.sf.hibernate.impl.SessionImpl.doSave(Ljava.lang.Object;Ljava.io.Serializable;Z)Ljava.io.Serializable;(SessionImpl.java:803)
at net.sf.hibernate.impl.SessionImpl.save(Ljava.lang.Object;)Ljava.io.Serializable;(SessionImpl.java:682)
etc...

Removing an erroneous not-null attribute from my mapping file yielded better results.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 31, 2003 12:48 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Yup, its true.

This is a good thing, I think :->

Should I throw some other exception than NPE? No, I think NPE is best.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 31, 2003 1:33 pm 
Beginner
Beginner

Joined: Wed Aug 27, 2003 4:17 pm
Posts: 27
Location: California, USA
TransientObjectException would be a better choice, in the case of a property that refers to a transient object. I propose http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-442


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 02, 2003 1:50 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
If it can refer a non-null object (in form of another object instance) then NPE sounds "wrong".

IllegalStateException and IllegalArgumentException sounds more "liable" .......

_________________
Max
Don't forget to rate


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.