Yes, of course. The issue is that we have a huge 10+ years application with more than 300 entities and unfortunately more than 100 entities are polymorphic entities, some with a few hierarchy levels (single table with column discriminator). Almost all of these polymorphic entities are annotated with @Proxy(lazy=false) , except this one case that made me report this issue. Because this one wasn’t annotated, and that relationship was returning a proxied entity, we started getting ClassCastException in several places in our code. Adding @Proxy(lazy=false) solves this issue, but I’m aware this is not a good solution and also that @Proxy just got deprecated. When reporting this issue I wasn’t aware all the reasoning why we were using this annotation, but now that’s completely clear for me, and it was a lazy workaround to avoid `ClassCastException` and continue to use type cast and instanceof statements for such entities. Since I see that @Proxy probably will get no replacement ( [ HHH-15772 Closed deprecate @Target, @Proxy, @Polymorphism - Hibernate JIRA (atlassian.net)|https://hibernate.atlassian.net/browse/HHH-15772] ), I’m moving to a definitive solution:
So, in summary I wasn’t sure if this specific change in behaviour in hibernate was intended or not, therefore I created this issue with a test case. Now with more clarity, I understand this was intended and I just need to handle its consequence and probably this issue should be closed. Thanks |