hibernate如果要使用getCurrentSession

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

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

posted @ 2018-05-16 15:46  傲云萧雨  阅读(340)  评论(0编辑  收藏  举报