This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Using JPA 2.0, I do not want that lazy loaded relationships become loaded after closing EntityManager.
This is what I'm using
I mean, If an Entity object has a (lazily loaded) collection of other Entities, I expect that after closing the EntityManager, those relationships are not loaded. I want null fields or a NullPointerException. But what I'm getting after closing the EntityManager is the full node tree.
As you can see, B may be too big to keep in memory. For example, I want to list all the 500 instances of A. And each A has 100 B, so I have a total of 5000 B objects. I want ONLY the list of A, without their B's loaded. But I'm getting all the 500 A's and all the 5000 B's.