The issues
HHH-11280 Open and
HHH-2921 Closed both run into the same underlying problem, that proxies for polymorphic entities have the wrong type. The PR offered for
HHH-11280 Open would at least disassociate the proxy and put the correct entity into the persistence context, but I'd like to go one step further as has been requested by
HHH-2921 Closed and additionally replace the proxies in all managed objects by the correct entity. In order to do this efficiently, we'd have to know all properties that have a polymorphic type. When narrowing a proxy in the StatefulPersistenceContext we can then lookup the affected properties and replace the proxy by the real instance in all managed objects. |