-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate ignoring cache.provider_class
PostPosted: Wed Jan 09, 2008 9:15 am 
Newbie

Joined: Wed Jan 09, 2008 9:04 am
Posts: 2
Hibernate version 3.2.5...

I'm trying to implement caching, deploying a simple WAR in Tomcat. The WAR works - no caching exceptions, but caching settings in hibernate.cfg.xml are apparently ignored. Can anyone help?

Here are some relevant log lines:

Code:
[INFO ] org.hibernate.cfg.SettingsFactory  - RDBMS: MySQL, version: 5.0.45-log
[INFO ] org.hibernate.cfg.SettingsFactory  - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.5 ( Revision: ${svn.Revision} )
[INFO ] org.hibernate.dialect.Dialect  - Using dialect: org.hibernate.dialect.MySQLDialect
[INFO ] org.hibernate.transaction.TransactionFactoryFactory  - Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
[INFO ] org.hibernate.transaction.TransactionManagerLookupFactory  - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
[INFO ] org.hibernate.cfg.SettingsFactory  - Automatic flush during beforeCompletion(): disabled
[INFO ] org.hibernate.cfg.SettingsFactory  - Automatic session close at end of transaction: disabled
[INFO ] org.hibernate.cfg.SettingsFactory  - JDBC batch size: 15
[INFO ] org.hibernate.cfg.SettingsFactory  - JDBC batch updates for versioned data: disabled
[INFO ] org.hibernate.cfg.SettingsFactory  - Scrollable result sets: enabled
[DEBUG] org.hibernate.cfg.SettingsFactory  - Wrap result sets: disabled
[INFO ] org.hibernate.cfg.SettingsFactory  - JDBC3 getGeneratedKeys(): enabled
[INFO ] org.hibernate.cfg.SettingsFactory  - Connection release mode: auto
[INFO ] org.hibernate.cfg.SettingsFactory  - Maximum outer join fetch depth: 2
[INFO ] org.hibernate.cfg.SettingsFactory  - Default batch fetch size: 1
[INFO ] org.hibernate.cfg.SettingsFactory  - Generate SQL with comments: disabled
[INFO ] org.hibernate.cfg.SettingsFactory  - Order SQL updates by primary key: disabled
[INFO ] org.hibernate.cfg.SettingsFactory  - Order SQL inserts for batching: disabled
[INFO ] org.hibernate.cfg.SettingsFactory  - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
[INFO ] org.hibernate.hql.ast.ASTQueryTranslatorFactory  - Using ASTQueryTranslatorFactory
[INFO ] org.hibernate.cfg.SettingsFactory  - Query language substitutions: {}
[INFO ] org.hibernate.cfg.SettingsFactory  - JPA-QL strict compliance: disabled
[INFO ] org.hibernate.cfg.SettingsFactory  - Second-level cache: enabled
[INFO ] org.hibernate.cfg.SettingsFactory  - Query cache: disabled
[INFO ] org.hibernate.cfg.SettingsFactory  - Cache provider: org.hibernate.cache.NoCacheProvider
[INFO ] org.hibernate.cfg.SettingsFactory  - Optimize cache for minimal puts: disabled
[INFO ] org.hibernate.cfg.SettingsFactory  - Structured second-level cache entries: disabled
[INFO ] org.hibernate.cfg.SettingsFactory  - Echoing all SQL to stdout
[INFO ] org.hibernate.cfg.SettingsFactory  - Statistics: disabled
[INFO ] org.hibernate.cfg.SettingsFactory  - Deleted entity synthetic identifier rollback: disabled
[INFO ] org.hibernate.cfg.SettingsFactory  - Default entity-mode: pojo
[INFO ] org.hibernate.cfg.SettingsFactory  - Named query checking : enabled



Here is my hibernate.cfg.xml (slightly altered to protect client privacy)
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-configuration SYSTEM "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="">
  <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
  <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/DB</property>
  <property name="hibernate.connection.username">abc</property>
  <property name="hibernate.connection.password">abc</property>
  <property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
  <property name="show_sql">true</property>
  <property name="format_sql">true</property>
     
  <property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
  <property name="hibernate.generate_statistics">true</property>
  <property name="hibernate.cache.use_query_cache">false</property>
  <property name="hibernate.cache.use_structured_entries">true</property>
  <property name="hibernate.cache.use_second_level_cache">true</property>
 
 
  <property name="current_session_context_class">thread</property>
  <!-- List of XML mapping files -->

   <mapping class="com.tmgc.doof.manager.data.Country" />
   <!-- ... Other class definitions removed -->
      
   <!-- Cache configuration -->   
   <class-cache class="com.data.Country" usage="read-only" />
   
      
</session-factory>
</hibernate-configuration>



I have an ehcache.xml file in /WEB-INF/classes, and the ehcache lib file that came with hibernate 3.2 in /WEB-INF/lib, but it looks to me as though Hibernate isn't even going to look for the ehcache.xml file because it hasn't recognised the need to use EHCache at all... (or stats, for that matter)

Am I missing something obvious? :)

Thanks,
Mick


Top
 Profile  
 
 Post subject: Re: Hibernate ignoring cache.provider_class
PostPosted: Wed Jan 09, 2008 10:44 am 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
I put these two and I am good. Could it be the name of the properties?

Code:
<property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
<property name="cache.use_second_level_cache">true</property>



Farzad-


Top
 Profile  
 
 Post subject: Re: Hibernate ignoring cache.provider_class
PostPosted: Wed Jan 09, 2008 10:58 am 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
farzad wrote:
I put these two and I am good. Could it be the name of the properties?

Code:
<property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
<property name="cache.use_second_level_cache">true</property>



Farzad-



I doubt this will solve the problem since hibernate accepts both kind of property names. Where do you put the hibernate cfg file and how do you create a session? If you like, try to put something crazy in the hibernate cfg file and see if that brakes the startup. This is usually a good smoke test to see if a config file is picked up.



Farzad-


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 09, 2008 12:10 pm 
Newbie

Joined: Wed Jan 09, 2008 9:04 am
Posts: 2
Thanks Farzad. The problem turned out to be in the any build, but your post put me on the right track.

Thanks,
Mick


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