[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-4791) Invalid assumption made in org.hibernate.envers.tools.Tools#getTargetFromProxy
Gail Badner (JIRA)
noreply at atlassian.com
Wed Jan 13 19:30:31 EST 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4791?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gail Badner closed HHH-4791.
----------------------------
Resolution: Fixed
> Invalid assumption made in org.hibernate.envers.tools.Tools#getTargetFromProxy
> ------------------------------------------------------------------------------
>
> Key: HHH-4791
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4791
> Project: Hibernate Core
> Issue Type: Bug
> Components: envers
> Affects Versions: 3.5.0-Beta-3
> Reporter: Steve Ebersole
> Assignee: Steve Ebersole
> Fix For: 3.5.0-Beta-3
>
> Time Spent: 2 hours
> Remaining Estimate: 0 minutes
>
> org.hibernate.envers.tools.Tools.getTargetFromProxy() attempts to initialize a proxy in a temporary session by calling AbstractLazyInitializer.setSession(tempSession) and explicitly initializing it.
> After HHH-4735 was fixed, AbstractLazyInitializer.setSession(tempSession) started failing if the proxy was already connected to a session (different from tempSession).
> As a result, BidirectionalReference.initData() is failing.
> There is another problem with Tools.getTargetFromProxy(). After the proxy is initialized in the temporary session, it is not reconnected to the original session.
> Both issues are fixed by using Session.get() to get the target from the temporary session and injecting the target into the proxy.
> Specifically, the following:
> proxy.getHibernateLazyInitializer().setSession((SessionImplementor) tempSession);
> proxy.getHibernateLazyInitializer().initialize();
> return proxy.getHibernateLazyInitializer().getImplementation();
> is replaced with:
> Object target = tempSession.get(
> proxy.getHibernateLazyInitializer().getEntityName(),
> proxy.getHibernateLazyInitializer().getIdentifier()
> );
> proxy.getHibernateLazyInitializer().setImplementation( target );
> return target;
--
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