[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2980) Error "org.hibernate.HibernateException: cannot simultaneously fetch multiple bags" not specific enough

Dobes Vandermeer (JIRA) noreply at atlassian.com
Fri Nov 30 22:23:56 EST 2007


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

Dobes Vandermeer commented on HHH-2980:
---------------------------------------

Well, my main suggestion is to indicate more clearly which condition caused the error.  I don't pretend to understand the source of the error, but removing a bunch of "FetchType.EAGER" from my class fixed it.

I haven't personally found anything in the JPA spec that says that an EAGER mapping requires that the fetch be done in a single SQL query.  It just seems to be talking about whether the objects are loaded immediately or on-demand.  For collections I just thought this meant that the JPA provider had the option of providing a collection class implementation that lazily fetched the records instead of immediately fetching the collection's contents using a new (or simultaneous) query.

It seem to me that if you issued multiple selects at the same time in order to fetch the collections, you might be able to get a queuing effect that reduces the effects of latency - e.g. I don't have to wait for the object to come back, then request the next one, I'd just request the object, request it's collections as the next result set(s) and then wait for the object, and then wait for each collection.

I did notice that the JPA spec *does* *require* that implementation support EAGER fetching, and says that *LAZY* fetching should be taken as just a hint.  That said, it's probably more applicable to NToOne and Basic columns.

Personally, I'd rather have it just issue a warning, or just ignore the EAGER fetches, than throw an error, because this same class is accepted by other implementations without complaint, AND it's compliant to spec ... hibernate seems like the bad boy here - first for adding a constraint that isn't part of the spec, and second for reporting the error so, so poorly.



> Error "org.hibernate.HibernateException: cannot simultaneously fetch multiple bags" not specific enough
> -------------------------------------------------------------------------------------------------------
>
>                 Key: HHH-2980
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2980
>             Project: Hibernate3
>          Issue Type: Improvement
>    Affects Versions: 3.2.5
>            Reporter: Dobes Vandermeer
>            Priority: Minor
>
> When I get this exception:
> org.hibernate.HibernateException: cannot simultaneously fetch multiple bags
> I don't know what to do except google.  Why not spruce it up a little to say something like:
> For class X, multiple collection fields are marked for eager fetching: a, b, c; this is not supported by Hibernate in releases after 3.2.x

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