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

Hibernate method to un-proxy a javassist proxy

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 4.2.21, 5.1.0, 5.0.9, 5.2.0
    • Fix Version/s: 5.2.10
    • Component/s: hibernate-core
    • Labels:
      None

      Description

      When retrieving a LAZY association property and attempting to downcast the returned entity, a ClassCastException is raised due to the use of the javassist proxy (even if the proxy is initialized). The proxy must be "unwrapped" to downcast using something like the below.

      ((org.hibernate.proxy.HibernateProxy) entity).getHibernateLazyInitializer().getImplementation();
      

      It would be useful to provide something like an org.hibernate.Hibernate.unproxy(Object proxy) method rather than requiring users to access the proxy interface as above.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: