[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2250) Create an appropriate error message if Query.setEntity is passed a NULL value

Steve Ebersole (JIRA) noreply at atlassian.com
Tue Nov 21 16:55:04 EST 2006


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2250?page=comments#action_25393 ] 

Steve Ebersole commented on HHH-2250:
-------------------------------------

You spent hours tracking something that is fairly obvious from the stack trace?  ouch!

I really dont understand the whole NPE is evil trip y'all are on here.  I mean think about the gist of the problem...  You passed a NULL POINTER...  How about IllegalArgumentException, does that somehow make it easier?

> Create an appropriate error message if Query.setEntity is passed a NULL value
> -----------------------------------------------------------------------------
>
>          Key: HHH-2250
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2250
>      Project: Hibernate3
>         Type: Improvement

>   Components: query-hql
>     Versions: 3.2.0.ga, 3.2.1
>     Reporter: Jonas Maurus
>     Priority: Minor

>
>
> setEntity(xyz, null) ends in a NPE in SessionImpl.guessEntityName(). This previously came up as HHH-675. I just spent hours tracking this NPE in our application, then upgrading Hibernate because I thought it might be a Hibernate bug :-/. The offending line read:
> .setEntity("customer", user.getCustomer())
> "user" being an entity managed by Hibernate with user.customer being a nullable ManyToOne-relation. The current mode of "crash-and-burn" really looks like a Hibernate bug and not like expected behavior. I'd like to recommend that setEntity() should explicitly check for null-values.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list