Guenther Demetz edited a comment 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 clear 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 within the same persistent context must continue to deliver that object to the user as proxy for all subsequent retrievals regardsless of which api is used (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, always 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 more documentation about Hibernate-Proxies and surely 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