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

Jonas Maurus (JIRA) noreply at atlassian.com
Fri Nov 17 11:30:06 EST 2006


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