JTASessionContext与JDBCTransactionFactory一起使用; 使用getCurrentSession()自动刷新将无法正常运行
在我的应用程序中使用hibernate,每次进行事务时,都会收到此警告。 这是垃圾邮件我的日志。
JTASessionContext being used with JDBCTransactionFactory; auto-flush will not operate correctly with getCurrentSession()
我认为它是由hibernate.current_session_context_class
属性引起的。
net.sourceforge.jtds.jdbc.Driver 5 false org.hibernate.dialect.SQLServerDialect jta
这是我应该担心的事吗? 如果没有,我怎么能阻止警告出现。
据我所知,除非你提供一个persistence.xml以便将数据源配置为JTA,否则不可能使用Spring配置Hibernate JPA和JTA支持。 也许这样的事情可以帮助你摆脱警告:
org.hibernate.ejb.HibernatePersistence blah blah
我还建议你禁用allowLocalTransactions,这样你的代码就会一直作为事务运行。