首页 新闻 会员 周边

Spring 3.5整合Hibernate3出现异常

0
悬赏园豆:20 [已解决问题] 解决于 2015-09-17 11:22

org.hibernate.HibernateException: save is not valid without active transaction
hibernate.cfg.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
    "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
   
<hibernate-configuration>
    <session-factory>
        <property name="dialect">org.hibernate.dialect.MySQL5Dialect</property>
        <property name="hbm2ddl.auto">update</property>
        <property name="show_sql">true</property>
        <!-- 加了这句报另外一个错误 -->
        <property name="hibernate.current_session_context_class">thread</property>
    </session-factory>
</hibernate-configuration>
萧萧弈寒的主页 萧萧弈寒 | 初学一级 | 园豆:170
提问于:2015-08-20 23:23
< >
分享
最佳答案
0
收获园豆:20
tony4geek | 菜鸟二级 |园豆:251 | 2015-08-24 09:51
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册