[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2369) Documentation doesn't state what hibernate returns for empty/null collections

Diego Pires Plentz (JIRA) noreply at atlassian.com
Tue Aug 14 11:04:13 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_27816 ] 

Diego Pires Plentz commented on HHH-2369:
-----------------------------------------

"This is all very well, but what does hibernate return when loading a null/empty collection?"

An empty collection, as the ejb3 specification say. We also could use basically the same sentence from ejb3 spec.

"If there are no associated entities for a multi-valued relationship of an entity fetched from the database, Hibernate will return an empty collection as the value of the relationship."

Were do you think that is a good place to put this? 

I think that "1.2.6. Loading and storing objects" (http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#tutorial-firstapp-workingpersistence) is a good place.

> Documentation doesn't state what hibernate returns for empty/null collections
> -----------------------------------------------------------------------------
>
>                 Key: HHH-2369
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2369
>             Project: Hibernate3
>          Issue Type: Improvement
>          Components: documentation
>    Affects Versions: 3.2.1
>            Reporter: James Roper
>            Priority: Trivial
>
> Reading the hibernate documentation, section 6.1:
> "Hibernate does not distinguish between a null collection reference and an empty collection"
> This is all very well, but what does hibernate return when loading a null/empty collection?
> According to the EJB3 specification, section 2.1.7:
> "If there are no associated entities for a multi-valued relationship of an entity fetched from the database, the persistence provider is responsible for returning an empty collection as the value of the relationship."
> If this is the behavior that hibernate implements, then this should be explicitly stated in the hibernate documentation, so that developers know whether they need to do null checks or not after loading an object from the database.

-- 
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