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.  [ 1 post ] 
Author Message
 Post subject: EHCache (Second level) and queries to a database
PostPosted: Wed Nov 25, 2009 8:36 pm 
Newbie

Joined: Wed Nov 25, 2009 8:22 pm
Posts: 2
I am beginning to get my hands dirty with Hibernate and I have configured my system to have an EHCache.

I have run into an issue where whenever I run a session.get(MyClass.class, int), I always seem to run a query against the database. I have set the object timeout to be longer than the amount of times that I execute multiple gets for this object. I turned on debug in log4j for the hibernate cache and hibernate jdbc packages. I have enabled both the second level cache and the query cache.

When i run a second get on the object, the log messages show that it has found the object since the following line is displayed:

DEBUG [http-7080-1] 2009-11-25 16:34:45,310 JCLLoggerAdapter.debug@170 key: com.objects.MyClass#2232

When I evict all objects from the sessionfactory cache, i see this message:

DEBUG [http-7080-1] 2009-11-25 16:35:40,356 JCLLoggerAdapter.debug@170 key: com.objects.MyClass#2232
DEBUG [http-7080-1] 2009-11-25 16:35:40,356 JCLLoggerAdapter.debug@170 Element for com.objects.MyClass#2232 is null

Either way I am seeing a query go against the database. I have the object set as read-write, however ,I know that the object is not being updated at all.

Am I just not understanding how the cache is supposed to work with Hibernate? Or is there some form of misconfiguration on my part?

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.