| Actually, I've figured out why it behaves this way. The @PostLoad callback is called AFTER all the attributes of the entities are loaded, but BEFORE any of the associations are loaded (even before eagerly fetches ones). In my @PostLoad callback, I access those eagerly fetched associations (which are collections), and that access triggers an early loading of the collection/associations. Since it is loaded within the context of a single entity, it uses a standard select. Once all of the container entities have executed their @PostLoad callback, hibernate tries to load the associations, but since the associations have already been populated for all of the container entities, there is nothing to do anymore and the bulk SUBSELECT is skipped. Now the question is: Is there a way for me to hook into the lifecycle of my container entity at the point where all the attributes have been loaded AND all eagerly fetched associations have ALSO been loaded? |