Using hibernate in my application, and everytime I do a transaction, I get this warning. It is spamming my logs.
JTASessionContext being used with JDBCTransactionFactory; auto-flush will not operate correctly with getCurrentSession()
I think it is caused by hibernate.current_session_context_class
property.
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
<property name="hibernate.connection.pool_size">5</property>
<property name="show_sql">false</property>
<property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="hibernate.current_session_context_class">jta</property>
<mapping class="foo.bar.Class1" />
<mapping class="foo.bar.Class2" />
<mapping class="foo.bar.Class3" />
<mapping class="foo.bar.Class4" />
<mapping class="foo.bar.Class5" />
</session-factory>
Is it something I should be worried about? If not, how can I stop the warning from appearing.
As far as I'm aware,it is not possible to configure Hibernate JPA with JTA support using Spring unless you provide a persistence.xml in order to configure the datasource as JTA. Perhaps some thing like this will help you get rid of the warning:
I would also suggest you to disable allowLocalTransactions so that your code will run as transactional all the time.