-->
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: Hibernate Second level Cache <<net.sf.ehcache.hibernate.EhCa
PostPosted: Sat Aug 01, 2009 9:49 am 
Newbie

Joined: Sat Jul 11, 2009 2:46 am
Posts: 7
Hi every one, I want use second level cache in my hibernate Project but I just know a little about hibernate second level cache, can any one explain how shoud I use this in my code and what configuration and .jar file I need? I set these setting to my hibernate.cfg.xml file:
Code:
 
               <property name="hibernate.cache.use_query_cache">true</property>
               <property name="hibernate.cache.use_second_level_cache">true</property>
               <property name="hibernate.cache.provider_class">net.sf.ehcache.hibernate.EhCacheProvider</property>

and add these jar file ehcache-1.6.1.jar, ehcache-1.6.1-javadoc.jar, ehcache-1.6.1-sources.jar.
I want know shoud I change any other configuration?
and how can I understand that my project uses Second level cache?
if just put this setting, hibernate automatically use this or I must use ant other code in my .java class(like any annotation or something else)

_________________
-*-*-*-*-*
[Am1rr3zA]


Top
 Profile  
 
 Post subject: Re: Hibernate Second level Cache <<net.sf.ehcache.hibernate.EhCa
PostPosted: Sun Aug 02, 2009 12:55 am 
Newbie

Joined: Sat May 30, 2009 2:47 am
Posts: 12
You need to turn on hibernate debug message in order to know any cache miss or hit.

ReadWriteCache, UpdateTimestampsCache, and StandardQueryCache are the main classes you will be interested to see cache hit/miss.

Hibernate uses log4j (for my 3.3.2 version). Here is my log4j.properties:

# define the root logger with two appenders writing to console and file
log4j.rootLogger=OFF,CONSOLE
#log4j.rootLogger=INFO,CONSOLE
#log4j.rootLogger=INFO,CONSOLE,FILE

log4j.logger.org.hibernate=OFF
#log4j.logger.org.hibernate.cache=TRACE
log4j.logger.org.hibernate.cache.ReadWriteCache=TRACE
log4j.logger.org.hibernate.cache.UpdateTimestampsCache=TRACE
log4j.logger.org.hibernate.cache.StandardQueryCache=TRACE



#define the appender named
log4j.appender.FILE=org.apache.log4j.FileAppender
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.File=./log4j.out
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%5p | %d | %C | %L | %m%n
#log4j.appender.FILE.MaxFileSize=1000KB

#define the appender named CONSOLE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%5p | %d | %C | %L | %m%n


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.