public

Spring 3.1, Hibernate 4 and Jboss 7 configuration

  • Download Gist
Spring3_Hibernate4_Configiration.xml
XML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
<!--Transactions are managed by Spring. I am not sure which transaction factory should be used for 'hibernate.transaction.factory_class'. I
feel it should be org.hibernate.engine.transaction.internal.jta.JtaTransactionFactory because we get BMT with Spring. Check
https://hibernate.onjira.com/browse/HHH-7215. So far I have not seen any side effects of this configuration probably because Jboss TS
transaction related data is thread bound and both UserTransaction and TransactionManager implementations will have reference to transaction
instance with same state.Please comment if you see any side effects of this configuration-->
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource"><ref bean="dataSource" /></property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
hibernate.bytecode.use_reflection_optimizer=true
hibernate.cache.use_second_level_cache=true
hibernate.cache.use_query_cache=true
hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory
hibernate.transaction.jta.platform=org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform
hibernate.transaction.factory_class=org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory
hibernate.hbm2ddl.auto=update
hibernate.show_sql=false
</value>
</property
</bean>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.