Hi,
I am new to Hibernate and I am facing this weird issue of Transaction getting commited whenever the data is Flushed.
When we do an
Insert/Update operation and execute a query, data gets flushed automatically as the
FlushMode.AUTO is set by default. At this stage, Transaction is getting commited which is causing serious issues in our application.
Is this an expected behaviour of Hibernate to commit transaction on FLUSH???
Or is there some setting which we miss in our application to avoid this??
Code:
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="persistenceUnitManager" ref="persistenceUnitManager" />
<property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
<property name="persistenceUnitName" value="bdmPU" />
<property name="jpaProperties">
<props>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.use_sql_comments">true</prop>
<prop key="hibernate.bytecode.provider">javassist</prop>
</props>
</property>
</bean>
<bean id="persistenceUnitManager" class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
<property name="defaultDataSource" ref="dataSource" />
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
<property name="jpaDialect">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />
</property>
</bean>