| Jonathan Halliday Actually, AccessType.FIELD can be used (and be useful) with private fields. And even if you use AccessType.FIELD, so long as you only ever access you entity through getters, everything will work fine: any call to a getter will trigger the initialization for the whole entity. Anyway... I managed to set up a test case: https://github.com/yrodiere/hibernate-test-case-templates/tree/HSEARCH-2541-HHH. The second-but last commit introduces a failing test case, and the last commit fixes the issue by setting up bytecode enhancement (that allows Javassist to proxify field accesses). You can get more information about bytecode enhancement there: http://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/Hibernate_User_Guide.html#BytecodeEnhancement-enhancement Note that, surprisingly, the test works fine with EntityManager.load, which suggest we are using the wrong method when retrieving entities. I'll look into it. |