-->
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.  [ 5 posts ] 
Author Message
 Post subject: Caching behaviour: what gets cached by default when?
PostPosted: Tue May 25, 2004 12:28 am 
Newbie

Joined: Tue May 25, 2004 12:18 am
Posts: 4
I have two client applications. Both applications are running (in separate VMs).

The first application carries out a query using session.find(String). The session is closed following the query.

The second application updates an object that was a child of the object returned in the above query using session.saveOrUpdate() and a transaction commit: the changes are reflected immediately in the database. The session is closed following the update.

The first application carries out the same query it did the first time. To my surprise, it does not show the changes that the second application has made to the object.

When (if ever) does Hibernate check to see if objects it has cached on return from a query are dirty? How can I remedy/control this situation?

Note that the two applications are running in different VMs and are therefore using separate database connections and separate session factories. The session factory is alive for the whole application lifetime, but the sessions are created and closed with each query or update.

Thanks,

Gareth.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 25, 2004 8:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
If you are accessing the same database from different VMs, you probably should not use caching at all. Otherwise you have to implement some kind of communication mechanism to tell the other VM it has to flush the cache - how should Hibernate know otherwise if someone else changed the database?


Top
 Profile  
 
 Post subject: How to disable caching then...
PostPosted: Tue May 25, 2004 5:04 pm 
Newbie

Joined: Tue May 25, 2004 12:18 am
Posts: 4
I should have included more in the way of the "default" behaviour I mentioned in the subject of the original posting. AFAIK there is no caching enabled, I have the query cache property set to false. I have changed no other properties and my configuration is a copy of the one supplied with Hibernate. Is there some other property I should be configuring to disable the caching?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 25, 2004 6:03 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
The second level cache is disabled by default.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 25, 2004 6:21 pm 
Newbie

Joined: Tue May 25, 2004 12:18 am
Posts: 4
Good... so what group of properties govern the second-level cache and is there any other possible reason for the problem that I am having?


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