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: Cache issues with reading from the database
PostPosted: Wed Oct 28, 2009 3:20 pm 
Newbie

Joined: Fri Jun 26, 2009 2:22 pm
Posts: 6
I have a website I developed using NHibernate and it works great. I recently also created a windows service which utilized NHibernate. I'm new to NHibernate (about 6 months) so the whole cache thing has thrown me for a loop. I noticed that changes that were being made to the database outside of my windows service didn't show up when I grabbed a bunch of objects that I thought were being pulled from the database. Thus I learned about first-level cache.

I really don't want to completely rewrite my fabulous Domain-Driven Designed system to accomodate something that is considered a feature in NHibernate but it is causing me issues with other programs that access the database beside my own. I looked at using the IStatelessSession but it didn't seem to support some stuff that the I'm using in ISession so I would rather stay where I am with that.

How else can I force NHibernate to always go grab from the database? I'm using code from "NHibernate with ASP.Net Problem-Design-Solution" to implement my DDD.


Top
 Profile  
 
 Post subject: Re: Cache issues with reading from the database
PostPosted: Fri Oct 30, 2009 3:26 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
I suppose the easiest way is to use a new session every time you read from the database or to clear the session after reading.

_________________
--Wolfgang


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.