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.
I have one doubt regarding Laxy loading of the objects in JPA. Let us suppose i have one entity Class A. A is mapped with one to many with B and B is mapped with C as Many to one. Below is sample class struture.
1. B is defined as Lazy in A. Now if i will do entityManager.find(A), it will not load the data from B as due to Lazy. If i have made it Eager and they try to load entity A. then It should have to load entity of B also. Now C is defined as Lazy in B. Will it fetch data for entity C also in above case.
No it will probably will not. Remember that using the fetchtype to lazy is only a hint. It is not enforcing. The JPA provider might decide to load it anyway. If you set the fetchtype to eager then the provider must load it.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.