Yeah so that’s a simply terrible thing to do.
Instead, use the static methods on the Hibernate class if you need access to the concrete type of a proxy.