-->
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.  [ 7 posts ] 
Author Message
 Post subject: ICriteria/IQuery SetReadOnly
PostPosted: Tue Jan 30, 2007 4:51 pm 
Newbie

Joined: Sun Nov 26, 2006 4:08 pm
Posts: 10
Location: Seattle, WA
In Hibernate you can call setReadOnly(true) on a query or criteria in order to tell Hibernate not to persist the object context (and therefore not flush the objects loaded in that query). Is this possible in Nhibernate? There doesn't seem to be this method or property and all searching I've done about flushing only some objects mentions multiple sessions and eviction...

Thanks,

Aaron


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 30, 2007 10:12 pm 
Regular
Regular

Joined: Tue Aug 08, 2006 4:28 am
Posts: 96
Location: Hong Kong
Aaron,

I am not sure if NHibernate.ICriteria.SetCacheable(System.Boolean) serves your purpose.

Regards,

Ken


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 01, 2007 1:40 pm 
Newbie

Joined: Sun Nov 26, 2006 4:08 pm
Posts: 10
Location: Seattle, WA
Nope, cacheable is different. That allows you to decide whether or not the query itself is cacheable in the query cache afaik. It does not affect whether or not the objects retrieved by that query are kept in the persistence context and therefore flushed at the next flush.

I'm also confused as to why immutable objects are flushed... is that just for integrity's sake? Seems like something that should only be done in dev land a la asserts (it throws an exception anyways).

Is the only way to control flushing really to have two separate sessions? That seems like quite a hack to me for something that is done nicely in Hibernate.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 17, 2007 7:03 pm 
Newbie

Joined: Sun Nov 26, 2006 4:08 pm
Posts: 10
Location: Seattle, WA
Is this supported or not? Will it ever be?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 18, 2007 5:29 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
It's not supported now but there isn't anything preventing it from being implemented.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 18, 2007 1:05 pm 
Newbie

Joined: Sun Nov 26, 2006 4:08 pm
Posts: 10
Location: Seattle, WA
Should I JIRA it? This would be a pretty big performance win for us and anyone else that uses large trees of read-only objects.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 18, 2007 1:25 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Yes, do it.


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