I am using hibernate.cfg.xml in the classpath and HibernateUtil mechanism to load the SessionFactory. The sessionFactory is bound to the
JNDI using the name attribute in config file and also using hibernate.session_factory_name property. Without the treecache properties
<property name="cache.provider_class">org.hibernate.cache.TreeCacheProvider</property>
<property name="cache.use_query_cache">true</property>
The SessionFactory binds correctly to jndi and the application works as expected.
As soon as I add the treecache properties, int he first pass of initialization, it looks like the SessionFactory is bound to JNDI. But for some reason, Hibernate goes through another pass at rebuilding the session and this time it is not bound. The net effect of this the SessionFactory is not bound to the JNDI and the application fails when it looks up.
Anyone has any insights? Unfortunately the MBean route is not an option for either the Hibernate or JBossCache.
Hibernate version: 3.2.4.sp1
JBoss Cache Version - 1.4.1.SP9
Jboss Version - 4.2.3
Mapping documents:
<hibernate-configuration>
<session-factory name="java:/hibernate/PrimarySessionFactory">
<!-- properties -->
<property name="hibernate.session_factory_name">java:/hibernate/PrimarySessionFactory</property>
<property name="connection.datasource">java:/jdbc/conn_pool</property>
<property name="show_sql">false</property>
<property name="format_sql">true</property>
<property name="use_sql_comments">false</property>
<property name="hibernate.jdbc.batch_size">30</property>
<property name="transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
<property name="transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
<property name="jta.UserTransaction">java:comp/UserTransaction</property>
<property name="hibernate.current_session_context_class">jta</property>
<property name="cache.provider_class">org.hibernate.cache.TreeCacheProvider</property>
<property name="cache.use_query_cache">true</property>
<!-- mapping files -->
<mapping resource="com/abc/ObjectAVO.hbm.xml" />
<!-- cache settings -->
<class-cache class="com.abc.ObjectAVO" usage="read-write"/>
</session-factory>
</hibernate-configuration>
Debug level Hibernate log excerpt:
2008-10-08 14:42:30,614 DEBUG [org.hibernate.util.DTDEntityResolver] located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
2008-10-08 14:42:30,645 DEBUG [org.hibernate.cfg.Configuration] hibernate.session_factory_name=java:/hibernate/PrimarySessionFactory
2008-10-08 14:42:30,645 DEBUG [org.hibernate.cfg.Configuration] connection.datasource=java:/jdbc/conn_pool
2008-10-08 14:42:30,645 DEBUG [org.hibernate.cfg.Configuration] show_sql=false
2008-10-08 14:42:30,645 DEBUG [org.hibernate.cfg.Configuration] format_sql=true
2008-10-08 14:42:30,645 DEBUG [org.hibernate.cfg.Configuration] use_sql_comments=false
2008-10-08 14:42:30,645 DEBUG [org.hibernate.cfg.Configuration] hibernate.jdbc.batch_size=30
2008-10-08 14:42:30,645 DEBUG [org.hibernate.cfg.Configuration] transaction.factory_class=org.hibernate.transaction.CMTTransactionFactory
2008-10-08 14:42:30,645 DEBUG [org.hibernate.cfg.Configuration] transaction.manager_lookup_class=org.hibernate.transaction.JBossTransactionManagerLookup
2008-10-08 14:42:30,645 DEBUG [org.hibernate.cfg.Configuration] jta.UserTransaction=java:comp/UserTransaction
2008-10-08 14:42:30,645 DEBUG [org.hibernate.cfg.Configuration] hibernate.current_session_context_class=jta
2008-10-08 14:42:30,645 DEBUG [org.hibernate.cfg.Configuration] cache.provider_class=org.hibernate.cache.TreeCacheProvider
2008-10-08 14:42:30,645 DEBUG [org.hibernate.cfg.Configuration] cache.use_query_cache=true
2008-10-08 14:42:30,645 DEBUG [org.hibernate.cfg.Configuration] java:/hibernate/PrimarySessionFactory<-org.dom4j.tree.DefaultAttribute@13c2797 [Attribute: name resource value "com/xyz/ObjectAVO.hbm.xml"]
-----
Second Pass Log:
2008-10-08 14:42:36,682 INFO [org.hibernate.util.NamingHelper] JNDI InitialContext properties:{}
2008-10-08 14:42:36,682 INFO [org.hibernate.connection.DatasourceConnectionProvider] Using datasource: java:/jdbc/conn_pool
2008-10-08 14:42:36,682 INFO [org.hibernate.cfg.SettingsFactory] RDBMS: Microsoft SQL Server, version: 08.00.2039
2008-10-08 14:42:36,697 INFO [org.hibernate.cfg.SettingsFactory] JDBC driver: jTDS Type 4 JDBC Driver for MS SQL Server and Sybase, version: 1.2.2
2008-10-08 14:42:36,729 INFO [org.hibernate.dialect.Dialect] Using dialect: org.hibernate.dialect.SQLServerDialect
2008-10-08 14:42:36,744 INFO [org.hibernate.transaction.TransactionFactoryFactory] Transaction strategy: org.hibernate.transaction.CMTTransactionFactory
2008-10-08 14:42:36,744 INFO [org.hibernate.transaction.TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
2008-10-08 14:42:36,760 INFO [org.hibernate.transaction.TransactionManagerLookupFactory] instantiated TransactionManagerLookup
2008-10-08 14:42:36,760 INFO [org.hibernate.cfg.SettingsFactory] Automatic flush during beforeCompletion(): disabled
2008-10-08 14:42:36,760 INFO [org.hibernate.cfg.SettingsFactory] Automatic session close at end of transaction: disabled
2008-10-08 14:42:36,760 INFO [org.hibernate.cfg.SettingsFactory] JDBC batch size: 30
2008-10-08 14:42:36,760 INFO [org.hibernate.cfg.SettingsFactory] JDBC batch updates for versioned data: disabled
2008-10-08 14:42:36,760 INFO [org.hibernate.cfg.SettingsFactory] Scrollable result sets: enabled
2008-10-08 14:42:36,760 DEBUG [org.hibernate.cfg.SettingsFactory] Wrap result sets: disabled
2008-10-08 14:42:36,760 INFO [org.hibernate.cfg.SettingsFactory] JDBC3 getGeneratedKeys(): enabled
2008-10-08 14:42:36,760 INFO [org.hibernate.cfg.SettingsFactory] Connection release mode: auto
2008-10-08 14:42:36,760 INFO [org.hibernate.cfg.SettingsFactory] Default batch fetch size: 1
2008-10-08 14:42:36,760 INFO [org.hibernate.cfg.SettingsFactory] Generate SQL with comments: disabled
2008-10-08 14:42:36,760 INFO [org.hibernate.cfg.SettingsFactory] Order SQL updates by primary key: disabled
2008-10-08 14:42:36,760 INFO [org.hibernate.cfg.SettingsFactory] Order SQL inserts for batching: disabled
2008-10-08 14:42:36,760 INFO [org.hibernate.cfg.SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
2008-10-08 14:42:36,760 INFO [org.hibernate.hql.ast.ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
2008-10-08 14:42:36,760 INFO [org.hibernate.cfg.SettingsFactory] Query language substitutions: {}
2008-10-08 14:42:36,760 INFO [org.hibernate.cfg.SettingsFactory] JPA-QL strict compliance: disabled
2008-10-08 14:42:36,760 INFO [org.hibernate.cfg.SettingsFactory] Second-level cache: enabled
2008-10-08 14:42:36,760 INFO [org.hibernate.cfg.SettingsFactory] Query cache: enabled
2008-10-08 14:42:36,760 INFO [org.hibernate.cfg.SettingsFactory] Cache provider: org.hibernate.cache.TreeCacheProvider
2008-10-08 14:42:36,775 INFO [org.hibernate.cfg.SettingsFactory] Optimize cache for minimal puts: enabled
2008-10-08 14:42:36,775 INFO [org.hibernate.cfg.SettingsFactory] Structured second-level cache entries: disabled
2008-10-08 14:42:36,775 INFO [org.hibernate.cfg.SettingsFactory] Query cache factory: org.hibernate.cache.StandardQueryCacheFactory
2008-10-08 14:42:36,775 TRACE [org.hibernate.exception.SQLExceptionConverterFactory] Using dialect defined converter
2008-10-08 14:42:36,791 INFO [org.hibernate.cfg.SettingsFactory] Statistics: disabled
2008-10-08 14:42:36,791 INFO [org.hibernate.cfg.SettingsFactory] Deleted entity synthetic identifier rollback: disabled
2008-10-08 14:42:36,791 INFO [org.hibernate.cfg.SettingsFactory] Default entity-mode: pojo
2008-10-08 14:42:36,791 INFO [org.hibernate.cfg.SettingsFactory] Named query checking : enabled
2008-10-08 14:42:36,853 INFO [org.hibernate.impl.SessionFactoryImpl] building session factory
2008-10-08 14:42:36,853 DEBUG [org.hibernate.impl.SessionFactoryImpl] Session factory constructed with filter configurations : {}
----
2008-10-08 14:42:36,853 DEBUG [org.hibernate.cache.TreeCacheProvider] Configuring TreeCache from resource [treecache.xml]
2008-10-08 14:42:36,994 INFO [org.hibernate.transaction.TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
2008-10-08 14:42:37,009 INFO [org.hibernate.transaction.TransactionManagerLookupFactory] instantiated TransactionManagerLookup
|