-->
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.  [ 3 posts ] 
Author Message
 Post subject: lazy="true" not working!
PostPosted: Thu Aug 24, 2006 9:38 am 
Beginner
Beginner

Joined: Mon Dec 26, 2005 4:55 pm
Posts: 28
Hello,

I have a group of objects persisted using Hibernate. I have a Client object that can have a list of Contacts, and also is linked with a class Address.

Now before the client object was set up in a way that once loaded, all it's Contacts where also loaded.

I did not want this since it was effecting the performance of the web application. Therefore I set the XDoclet command as follows for the Client object.

Code:
/* . . .
* @hibernate.list inverse="true" cascade="all" lazy="true"
* @hibernate.collection-key column="client"
* @hibernate.collection-index column="id"
* @hibernate.collection-one-to-many class="com.my.comon.Contact"
*/
public List<Contact> getContacts(){
   . . .
}

Now as you can notice, I have set the field lazy="true" however the Contact objects are still loaded! I know this because I can see the generated Sql. however this field lazy="true" is working fine on another list of objects related with Client.

does anyone has any ideas on what I should check?

reagrds,
Sim085


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 24, 2006 10:03 am 
Beginner
Beginner

Joined: Mon Dec 26, 2005 4:55 pm
Posts: 28
ps: I forgot to mention that I am using Hibernate 3.0

Regards,
Sim085


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 24, 2006 4:31 pm 
Beginner
Beginner

Joined: Mon Dec 26, 2005 4:55 pm
Posts: 28
It is me again.

I have been searching in XDoclet and hibernate documentation. All I can read is that lazy="true" means that the objects of the particular list will not be loaded when the object containing the list is loaded! I really can not understand why it is still being loaded (displaying the Sql to retrieve all the contacts of a client!).

Could another tag in the Contacts class be effecting the load? (for example the reference between Contact and Client?)

Thanks and Regards,
Sim085

ps: I have seen some posts that disscuss that in version 3.03 there was an introduction of lazy="proxy". However the current version of hibernate I have does not support this flag.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.