Hibernate method to un-proxy a javassist proxy

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.

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.

Environment

None

Status

Assignee

Vlad Mihalcea

Reporter

Stephen Fikes

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

backportDecision

None

Components

Affects versions

Priority

Minor
Configure