标签:
org.hibernate.HibernateException: Could not obtain transaction-synchronized Session for current thread org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:134) org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:1014) com.eric.cms.content.dao.UserDaoImpl.addUser(UserDaoImpl.java:21) com.eric.cms.content.service.UserServiceImpl.addUser(UserServiceImpl.java:21) com.eric.cms.content.controller.LoginController.login(LoginController.java:27) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:175) org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:446) org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:434)
原因:hibernate4不支持你用hibernate3的 getcurrentSession,建议你用openSession
Hibernate4运行报错Could not obtain transaction-synchronized Session for current thread
标签:
原文地址:http://www.cnblogs.com/langtianya/p/4922680.html