[hibernate-issues] [Hibernate-JIRA] Commented: (EJB-346) Hibernate is not JPA compliant when using multiple EAGER OneToMany relationships

Doug Bateman (JIRA) noreply at atlassian.com
Mon Mar 24 17:01:33 EDT 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/EJB-346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_29863 ] 

Doug Bateman commented on EJB-346:
----------------------------------


This issue has been reported before with issues:
EJB-217
EJB-304
HHH-1413

The first two issues were marked "Resolved" when the "Hibernate specific annotations" fix was mentioned.  However, this fails to address the fundamental issue that Hibernate fails to provide JPA compliant behavior by default.  Because of this, both issues were marked "Resolution Rejected" by their original submitters, but have subsequently been ignored since 2006.  Technically it is fair to claim those defects as "resolved" since the original complaint was "lack of support" rather than "lack of JPA compliance".  I am thus opening this issue to help provide for proper attention & triage to the "lack of JPA compliance" issue.

Issue HHH-1413 recommends an acceptable solution: Modify Hibernate to simply @Fetch(FetchMode.SUBSELECT) the automatic default when a mapped object has multiple bags.  This solution provides for JPA compatability, and yet you still avoid the NxM problem associated with joining across several multi-valued attributes.

This issue is still seperate from HHH-1413 as HHH-1413 is a feature request, where as this feature is a JPA imcompatability bug report.

> Hibernate is not JPA compliant when using multiple EAGER OneToMany relationships
> --------------------------------------------------------------------------------
>
>                 Key: EJB-346
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-346
>             Project: Hibernate Entity Manager
>          Issue Type: Bug
>    Affects Versions: 3.3.0.ga
>            Reporter: Doug Bateman
>
> JPA compatibility is broken when mapping a JPA object with multiple eagerly loaded one-to-many mappings.  Specifically, Hibernate's behavior is as follows:
> + If a JPA persistent object has multiple fields with "@OneToMany(fetch=FetchType.EAGER)" Hibernate throws "HibernateException: cannot simultaneously fetch multiple bags"
> + This issue is fixed only when the user adds the Hibernate specific annotation @Fetch(FetchMode.SUBSELECT)
> To be JPA compliant, Hibernate must be able to map any JPA compliant object, without requiring additional Hibernate specific annotations.  JPA expressly allows multiple one-to-many mappings (with the implied assumption that subselects are used by default in this case).

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