Hibernate Version 3.0.1
JDK Version 1.4.2_05
Oracle Version 9i
I have a User Object which has a 1-many relationship with Role
The Role Object has a method getUser. When i try to access the getUser in my client program i get the LazyInitialization Exception.
I have set the "lazy" to be
false explicitly. This used to work in Hibernate v 2.1.8. I understand that the default for lazy = "true". In my server if i call explicitly getUser and pass the Role instance to the client i don't get that exception
Code:
<many-to-one
name="user"
class="com.xxx.org.entity.User"
cascade="none"
outer-join="auto"
lazy="false"
column="BUSINESS_ID"
/>
I have many objects in my system and there is a lot of one-many relationships. I understand the lazy behaviour on the one side of the relation but on the many side why should i explicitly call getUser to avoid the exception.