spring配置

解决方案 »

  1.   

    你的datasource绑定的对吗?
      

  2.   

    对头,我用opensession 正常查出来了
      

  3.   

    getCurentSession就是打开了1个session并且不能关闭他,你是不是配置了<property name="hibernate.current_session_context_class">thread</property>了,去掉
      

  4.   

    getCurentSession这种写法必须绑定事务,不然会报错。所以你需要添加配置:
    <property name="hibernate.current_session_context_class">thread</property>使用过程中,需要开启事务,不然不建议这种用法,只好用openSession!参考:http://blog.csdn.net/loveyout/article/details/4193894
      

  5.   

    确定 为了保险都给拦截了<aop:pointcut expression="execution(* com..*.*(..))" id="myCut" /> 哎纠结
      

  6.   

    但是我添加了spring事务管理了呀
      

  7.   

    在你的dao里有开启事务的过程吗?只在spring配置一下,那是不行的啊。
      

  8.   

    spring支持对hibernate的事务管理 dao中哪还需要开启呀
      

  9.   

    是不是用定时器或者其它不同线程的调用了?不同线程的没有相关配置不能获取当前线程的,只能openSession打开一个新的。