Search Interview Questions | Click here and help us by providing the answer. Click Correct / Improve and please let us know. |
|
|||
|
| ||||
| Hibernate - Interview Questions and Answers for 'Lazy loading hibernate' - 4 question(s) found - Order By Rating | ||||
| ||||
| Ans. Using lazy = false in hibernate config file or @Basic(fetch=FetchType.EAGER) at the mapping | ||||
| ||||
| Ans. It's a feature to lazily initialize dependencies , relationship and associations from the Database. Any related references marked as @OneToMany or @ManyToMany are loaded lazily i.e when they are accessed and not when the parent is loaded. | ||||
| ||||
| Ans. 1. Set lazy=false in the hibernate config file. 2. Set @Basic(fetch=FetchType.EAGER) at the mapping. 3. Make sure that we are accessing the dependent objects before closing the session. 4. Force initialization using Hibernate.initialize 5. Using Fetch Join in HQL. | ||||
| ||||
| Ans. After Hibernate 3.0 | ||||