Issue Type: Bug Bug
Affects Versions: 4.1.7
Assignee: Unassigned
Components: core
Created: 26/Oct/12 4:09 AM
Description:

When updating entity on a stand-alone environment (no JEE server) using JTA transaction manager the flush() method is never called on TX commit.
I tried to use the hibernate.transaction.flush_before_completion property as it seems to be the one that avoid the flush to occur but I found out it was forced to false by the EJB3Configuration.

Here is my Spring/Hibernate setup :

<beans profile="infinispan-no-server">

	<bean id="entityManagerFactory"
		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
		<!-- dataSource is a BasicDataSource from dbcp -->
		<property name="dataSource" ref="dataSource" />
		<property name="jpaVendorAdapter">
			<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
				<property name="database" value="H2" />
				<property name="generateDdl" value="false" />
				<property name="showSql" value="true" />
			</bean>
		</property>
		<property name="jpaPropertyMap" ref="jpaPropertyMap" />
		<property name="packagesToScan" value="com/**/model,com/**/model/impl" />
	</bean>

	<bean id="jbossTransactionManager"
		class="com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple" />

	<bean id="jbossUserTransaction"
		class="com.arjuna.ats.internal.jta.transaction.arjunacore.UserTransactionImple" />

	<bean id="transactionManager"
		class="org.springframework.transaction.jta.JtaTransactionManager">
		<property name="transactionManager" ref="jbossTransactionManager" />
		<property name="userTransaction" ref="jbossUserTransaction" />
	</bean>

	<util:map id="jpaPropertyMap">
		<entry key="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
		<entry key="hibernate.hbm2ddl.auto" value="none" />
		<entry key="hibernate.show_sql" value="true" />
		<!-- Second level cache -->
		<entry key="hibernate.generate_statistics" value="true" />
		<entry key="hibernate.cache.use_second_level_cache" value="true" />
		<entry key="hibernate.cache.use_query_cache" value="true" />

		<entry key="hibernate.session_factory_name" value="hibernate/AAMSessionFactory" />

		<entry key="hibernate.cache.region.factory_class"
			value="org.hibernate.cache.infinispan.InfinispanRegionFactory" />
		<!-- for https://jira.springsource.org/browse/SPR-9480 -->
		<entry key="hibernate.transaction.factory_class" value="org.hibernate.transaction.CMTTransactionFactory" />
		<entry key="hibernate.transaction.jta.platform"
			value="org.hibernate.service.jta.platform.internal.JBossStandAloneJtaPlatform" />
		<entry key="hibernate.cache.infinispan.statistics" value="true" />
		<!-- <entry key="hibernate.cache.infinispan.use_synchronization"
			value="true" /> -->

		<entry key="hibernate.cache.infinispan.cfg" value="infinispan.xml" />
		
		<!-- Does not work anyway, forced to false by Hibernate  -->
		<entry key="hibernate.transaction.flush_before_completion" value="true" />
	</util:map>

</beans>

It tried the same with simple EHCache with and without JTA :

  • Everything is fine without JTA
  • Same behaviour when using JTA (no flush)
Environment: Hibernate 4.1.7.Final, Spring 3.1.2.RELEASE, Infinispan 5.1.6.FINAL
Project: Hibernate ORM
Priority: Major Major
Reporter: Frederic Dreyfus
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira