Spring Transactions and hibernate.current_session_context_class

后端 未结 1 1906
醉梦人生
醉梦人生 2020-11-27 18:52

I have a Spring 3.2 application that uses Hibernate 4 and Spring Transactions. All the methods were working great and I could access correctly the database to save or retrie

相关标签:
1条回答
  • 2020-11-27 19:28

    When using spring and spring managed transactions never mess around with the hibernate.current_session_context_class property UNLESS you are using JTA.

    Spring will by default set its own CurrentSessionContext implementation (the SpringSessionContext), however if you set it yourself this will not be the case. Basically breaking proper transaction integration.

    The only reason for changing this setting is whenever you want to use JTA managed transactions, then you have to setup this to properly integrate with JTA.

    0 讨论(0)
提交回复
热议问题