Guenther Demetz commented on Bug HHH-7953

So why would it return a non-proxy instance for a find() on a clear()ed EM, but a proxy instance otherwise?

As all serious OR-Mappers, also Hibernate guarantees object identity within the persistent context.
As indirect consequence, Hibernate under certain circumstances MUST return a proxy instead of the proper entity object,
see following scenario:

entityManager.clear(); // start with a cleat persistent context
Child c1 = entityManager.getReference(Child.class, 20); // this returns a uninitialized proxy
...
Child c2 = entityManager.find(Child.class, 20); // the object get now initialized, but proxy is returned otherwise
(c1 == c2) would be false.

assertTrue(c1 == c2); 

Expressed in other words:
once hibernate delivers an entity object to the user as proxy,
then hibernate must continue to deliver that object to the user as proxy also for all subsequent operations (load,find, query etc.).

Also, for an initialized proxy, all the internal fields appear to be 'null', and not hold any value.

Yes, that's correct, only the identifier field(s) are filled in a proxy.
You have to access the entity properties via getter methods, so you will get the correct (non-null) values.
Read some documentation about Hibernate-Proxies and you will understand.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira