-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: LazyInitialization Exception access from the m side of 1-m
PostPosted: Wed Apr 20, 2005 11:14 pm 
Newbie

Joined: Wed Apr 20, 2005 10:57 pm
Posts: 6
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.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 22, 2005 10:38 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
please check the refrence guide on <class lazy="false">

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.