In the book you can read this at page 651:
"HQL and JPA QL ignore any fetching strategy you've defined in metadata. (...) A dynamic fetching strategy igores the global fetching strategy (on the other hand, the global fetch plan isn't ignored - every nonlazy association or collection is guaranteed to be loaded."[/i]
What does this exactly mean? In my experience, the last sentence is what you get on queries if you have EAGER loaded associations. But the first sentence just says the opposite. And: What is the difference between
"global fetching strategy" and the
"global fetch plan"?
The background of this question is discussed at:
http://forum.hibernate.org/viewtopic.php?p=2386043#2386043.
The question comes down to:
- if I do have EAGER mapped associations, are there any means to ignore these in a JPA query or with the Criteria API and do LAZY loading?
- if not: is there a chance that future versions of Hibernate / JPA will support this?
In the context where I'm working it is a very useful feature to have some associations loaded EAGERly. But on the other hand, as I said, this "global fetch plan" is not useful if you have specialized queries where you do not need and do not want the objects of the associations. So I resorted to native SQL (what I see as the last chance).
I know, the opposite feature (LAZY mappings, EAGER fetchings) is supported (because LAZY is Hibernate's default?)
Christian, could you please ask these questions?
Thanks, Carlo