ClassCastException due to "javassist" proxy in Hibernate
Issue
- An entity is fetched as part of a
LAZYassociation -
When downcasting the entity to the appropriate subclass (e.g. casting
TasktoSubTask), the following exception is raised:java.lang.ClassCastException: Cannot cast support.hibernate.entity.Task_$$_jvstb10_1 to support.hibernate.entity.SubTask
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7
- 6
- 5
- Red Hat JBoss Fuse 6
- Hibernate
- 4
- 3
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
