[hibernate-issues] [Hibernate-JIRA] Created: (HHH-4437) ToOneDelegateSessionImplementor breaks Hibernate.getClass(auditedEntity.proxyOfnotAuditedEntity)

Eugene Goroschenya (JIRA) noreply at atlassian.com
Sun Sep 13 09:37:50 EDT 2009


ToOneDelegateSessionImplementor breaks Hibernate.getClass(auditedEntity.proxyOfnotAuditedEntity)
------------------------------------------------------------------------------------------------

                 Key: HHH-4437
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4437
             Project: Hibernate Core
          Issue Type: Bug
          Components: envers
    Affects Versions: 3.3.x
            Reporter: Eugene Goroschenya
            Priority: Blocker


Probably there is mistake in changes applied for HHH-4010 that leads to incorrect working of Hibernate.getClass(proxy) method.

See ToOneDelegateSessionImplementor#doImmediateLoad(String entityName)
  ...
  Session session = versionsReader.getSession();
  return session.get(entityClass, (Serializable) entityId);
  ...

It can return proxy but Hibernate SessionImplementor interface says

/**
* Load an instance immediately. This method is only called when lazily initializing a proxy.
* Do not return the proxy.
*/
public Object immediateLoad(String entityName, Serializable id) throws HibernateException;

Probably solution is to use delegate.doImmediateLoad(entityClass, (Serializable) entityId) instead of session.get(entityClass, (Serializable) entityId) 

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