the test works fine with EntityManager.load, which suggest we are using the wrong method when retrieving entities. I'll look into it.
Agreed, we shouldn't force users to have enabled bytecode enhancement, especially as they didn't invoke a proxy-prone method themselves. We probably could use Session#get rather than Session#load to fire the immediate load.. Session#load will fail fast on missing entity though, so make sure to catch & ignore that for the case in which the index state is slightly out of date (e.g. async indexing is being used).
In such instances it's inappropriate for Hibernate to use proxies, since without a getter on the call path there is nothing to trigger population of the object. The metamodel should contain enough information to allow the engine to recognize this case, but apparently not.
Agreed as well.. we'll raise this with the ORM team. |