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 'Atos' - 1 question(s) found - Order By Newest | |||||||||||
| |||||||||||
| 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. | |||||||||||
org.hibernate.LazyInitializationException: could not initialize proxy - no Session | |||||||||||
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 | |||||||||||
| |||||||||||
| |||||||||||