zoukankan      html  css  js  c++  java
  • hibernate常见问题?

    1、

      <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">

      hibernate4版本<prop key="hibernate.current_session_context_class">thread</prop>---》获取当前会话会导致如下结果:

      异常信息:org.hibernate.HibernateException: save is not valid without active transaction

      hibernatenate4版本,取消<prop key="hibernate.current_session_context_class">thread</prop>会导致如下结果:

      异常信息: Already value [org.springframework.orm.hibernate5.SessionHolder@779dfe55] for key

      [org.hibernate.internal.SessionFactoryImpl@502f8b57]  bound to thread [main]

      

      解决:将hibernate版本改为hibernate5版本,hibernate可以直接使用getCurrentSession获取当前会话!

     

  • 相关阅读:
    CF293E Close Vertice
    [SCOI2016]幸运数字
    [NOI2003]逃学的小孩
    0302读后感
    1231递归下降语法分析
    1210-有穷自动机
    11.12 评论汇总
    1029语言文法
    0921 词法分析
    0909开启编译原理之路
  • 原文地址:https://www.cnblogs.com/xcggdd/p/6891789.html
Copyright © 2011-2022 走看看