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: lazy=true with criterias
PostPosted: Wed Jul 02, 2008 8:03 am 
Newbie

Joined: Wed Jul 02, 2008 7:54 am
Posts: 8
Location: Brussels
Hi,

I work with NHibernate 2.0

The application is done and I have to correct performances of the NHibernate layer.

So I have a hbm file with default-lazy="false". I don't want to delete it now, because it too dangerous for the application.

But I want to do a query on it with criterias and use lazy=true. For example :

Code:
Criteria crit = session.CreateCriteria(typeof(MaClass));
crit.SetLazy(true);


Is it possible to do something like that?

Thank you in advance


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 02, 2008 8:07 am 
Regular
Regular

Joined: Thu Mar 06, 2008 5:06 am
Posts: 68
You can do that with this method:

.SetFetchMode(NameOfRelation, FetchMode.Lazy);

Where NameOfRelation is the name you defined for the relation or collection which should be lazy loaded.


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.