Hi everybody,
I don’t want to open an issue about this before some clarifications.
We are talking about Byte Code Endhancement + Lazy Loading + ToOne polymorphic relations and so Inheritance between Entities .
I am trying to upgrade from Wildfly 26 to Wildfly 27.
This implies upgrading also from Hibernate 5.3 to 6.15.
In my project I use maven bytecode enhancement plugin.
With Hibernate 5.3 this is what I see :
With Hibernate 6.15 I see this :
As you can see, before upgrading, Credential has its ManyToOne relation with Person correctly populated and you can see LegalPerson (child type of Person).
After the upgrade, the same relation is populated with a Person@HibernateProxy.
Why ?
I double checked and my bytecode is indeed enchanced :
So what I am doing wrong ?
Why does Hibernate fallback to HibernateProxy ?
When loading the Credential instance Hibernate should leave its Person null until I lazily try to access the Person field and then retrieve the actual instance with the right subtype (LegalPerson).
I think this should be the proper way to handle Lazy Loading.
What is happening here ?
Thank you in advance.
If this is a regression indeed, I am going to file an issue.