Uploaded image for project: 'Hibernate ORM'
  1. HHH-4437

ToOneDelegateSessionImplementor breaks Hibernate.getClass(auditedEntity.proxyOfnotAuditedEntity)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects versions: 3.3.x
    • Fix versions: 3.5.0-Beta-2
    • Components: hibernate-envers
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

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

        Attachments

          Issue links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: