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