Hibernate Proxy initialization when accessing the identifier


#1

Hello,

I’m doing some testing regarding proxy initialization when accessing the identifier in Hibernate 5.3.0 final release.

As stated in this issue, according to JPA, a Proxy should be loaded even when accessing the identifier. But in my case, when I access to the id property of a Proxy it is not being initialized (which in fact is the behavior that I’m expecting)

But I just wanted to clarify if this is something configurable somehow, because as far as I understand from that issue, it seems that the Proxy should be initialized in this case also.

Thank you in advance!


#2

You need to set the hibernate.jpa.compliance.proxy property to true.

Check out the user guide for more details.


#3

Sorry, did not read that part…it is clear, thanks!