| Yes, I guess there are plenty of other ways to load the data from the database by bypassing the original entity even by not using an OR mapper. But the point is that the Hibernate javax.persistence.fetchgraph hint implementation can only be used to eagerly fetch LAZY attributes. But if you read the passages
An entity graph can be used with the find method or as a query hint to override or augment FetchType semantics.
and
When the javax.persistence.fetchgraph property is used to specify an entity graph, attributes that are specified by attribute nodes of the entity graph are treated as FetchType.EAGER and attributes that are not specified are treated as FetchType.LAZY.
in the spec, the Hibernate implementation cannot be used to override the FetchType behavior and thus is simply not compliant. That spec loophole smells to me like an opt-out clause to not having to make ones hands dirty and still being 2.1 "compliant". What do you think? |