How to integrate spring with hibernate session and transaction management?

前端 未结 2 947
一整个雨季
一整个雨季 2020-11-27 19:43

I am a beginner in both hibernate and spring. I have understood about the hibernate transaction demarcation (at least I think so). But after coding a few method like this:

相关标签:
2条回答
  • 2020-11-27 20:04

    @hephestos: The value for the parameter current_session_context_class decides the context to which the session (Hibernate session) must be bound with.

    By default it is bound with the currently running thread. But when "jta" is used to manage transactions, changing the value of this parameter to "jta" binds the session to the current JTA transaction context.

    Basically it defines the context for the sessions. More information: http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/architecture.html#architecture-current-session

    0 讨论(0)
  • 2020-11-27 20:14

    Remove the following line, it interferes with Spring-managed transactions:

    <property name="current_session_context_class">thread</property> 
    
    0 讨论(0)
提交回复
热议问题