-->
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.  [ 6 posts ] 
Author Message
 Post subject: don't need cache, how to disable?
PostPosted: Sat Sep 03, 2005 6:33 am 
Newbie

Joined: Mon Oct 18, 2004 9:38 am
Posts: 5
Hibernate version:2.0
Name and version of the database you are using:SQL Server 2000

We are using hibernate as our DAO layer..

1. I have a client application (built using swing) that talks to the tomcat server and downloads the required data and user can add new records thru' this client application, which does a SOAP call to tomcat & saves the data to database.

2. Data gets saved properly to the database, things are fine till now

3. Now if the user logs out from the client application & logs back in immediatly, the record he added in the earlier login does not display on the client application, I see the data exists in the DB.. its just that its not getting downloading to the client

4. I think somewhere the second login is getting the data from cache & its not made dirty while adding the new record to the DB.

Looking for either one of the solution -
a. Is there a way to indicate to hibernate to ALWAYS hit the DB to get the user data & not get it from cache at all?

b. Or is there a way to dirty the user data when I added a record? NOTE: At the time of adding the record I do not have the main User object and just only inserting a record for that user and only that record is passed from the client to server

Any help in resolving this... will be great.

Thanks
Bhaskar


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 03, 2005 11:49 am 
Senior
Senior

Joined: Wed Jul 13, 2005 4:31 pm
Posts: 142
Location: Seattle, WA
to turn off the caches -
set hibernate.cache.use_query_cache to false
and hibernate.cache.use_second_level_cache to false
in hibernate.cfg.xml or hibernate.properties


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 05, 2005 12:36 am 
Newbie

Joined: Mon Oct 18, 2004 9:38 am
Posts: 5
This did not work, I have set the flags as mentioned to false but still data is coming from cache when I download the user data for the second time.

-bhaskar


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 05, 2005 4:04 am 
Beginner
Beginner

Joined: Thu Sep 01, 2005 7:43 am
Posts: 31
Location: León (Spain)
Hibernate uses two caches. I don't know if you can disable the first level cache, but if my eyes don't fool me, your problem is that your objects doesn't update properly... Try issuing a refresh instead of disabling the caches:

mysession.refresh(object);

Bye.

_________________
Please rate...

Expert on Hibernate errors... I've had them all... :P


Top
 Profile  
 
 Post subject: Hibernate cache
PostPosted: Tue Feb 24, 2009 9:18 am 
Newbie

Joined: Mon Aug 18, 2008 9:52 am
Posts: 1
I am having the same problem. The database of my application gets updated by other applications also so i need to refresh the data from database every time i query. If you have the solution for this please let me know. I tried using

<property name="cache.use_query_cache">false</property>
<property name="cache.use_second_level_cache">false</property>


Top
 Profile  
 
 Post subject: Re: don't need cache, how to disable?
PostPosted: Fri Oct 23, 2009 8:55 am 
Newbie

Joined: Fri Oct 23, 2009 8:51 am
Posts: 1
Your problem seems to be related to connection pooling, try using dbcp connection pooling.


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