[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-3528) FETCH JOIN query doesn't work in a StatelessSession
Steve Ebersole (JIRA)
noreply at atlassian.com
Thu Mar 5 17:16:38 EST 2009
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3528?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Steve Ebersole updated HHH-3528:
--------------------------------
Attachment: HHH-3528-StatelessSession-fetching.patch
Here is the slightly different patch I committed
> FETCH JOIN query doesn't work in a StatelessSession
> ---------------------------------------------------
>
> Key: HHH-3528
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3528
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.2.6, 3.3.1
> Environment: Hibernate core 3.3.1 and 3.2.6, HSQLDB 1.8.0 and PostgreSQL 8.1
> Reporter: Oscar Pearce
> Assignee: Steve Ebersole
> Fix For: 3.3.x, 3.5
>
> Attachments: HHH-3528-StatelessSession-fetching.patch, slsession.zip, StatelessSessionImpl.patch
>
> Time Spent: 2 hours
> Remaining Estimate: 0 minutes
>
> A query with an explicit JOIN FETCH, such as the following:
> from DomainObject obj join fetch obj.a
> fails when run in a StatelessSession, giving the following exception:
> org.hibernate.SessionException: proxies cannot be fetched by a stateless session
> at org.hibernate.impl.StatelessSessionImpl.immediateLoad(StatelessSessionImpl.java:243)
> at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:95)
> at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:140)
> at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190)
> The attached zip file contains a small project (buildable with maven) that demonstrates the problem. Applying the patch to StatelessSessionImpl fixes it.
> The cause of the problem is with the internalLoad method of StatelessSessionImpl. The method currently first tries to generate a proxy and, only if no proxy is available, then it uses the data that it loaded as part of the query. The patch changes it to use any loaded data from the query in preference to creating a proxy. (I suspect that the check for eager should be omitted, and that an exception should be thrown if getEntity fails and no proxy can be created, but I don't know the code well enough to be sure of that.)
--
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