hibernate如果要使用getCurrentSession

* 如果使用的是本地事务(jdbc事务)
 <property name="hibernate.current_session_context_class">thread</property>
 * 如果使用的是全局事务(jta事务)
 <property name="hibernate.current_session_context_class">jta</property> 

此时无论是DML还是DQL都需要事务。

原文地址:https://www.cnblogs.com/wenwenzuiniucha/p/9046362.html