We're updating the issue view to help you get more done. 

ToOneDelegateSessionImplementor breaks Hibernate.getClass(auditedEntity.proxyOfnotAuditedEntity)

Description

Probably there is mistake in changes applied for 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)

Environment

None

Status

Assignee

AdamA

Reporter

Eugene Goroschenya

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

3.3.x

Priority

Blocker