错误是:Could not obtain transaction-synchronized Session for current thread
spring4+hibernate 事务管理的时候遇到一个问题,如题,openSession是可以的,但是sessionFactory.getCurrentSession()时候就出现上面的问题
而且郁闷的是junit4测试的时候也是可以getCurrentSession的,一步步运行进去可以看到是SpringSessionContent这个类中的currentSession方法报错的,抛出异常是因为
TransactionSynchronizationManager.isSynchronizationActive()为false
求大神指点迷津...