[英]getting hibernate session error in java
i have this 我有这个
SessionFactory sessionFactory = new AnnotationConfiguration()
.configure("com/vaannila/service/hibernate.cfg.xml")
.buildSessionFactory();
Session session = sessionFactory.getCurrentSession();
i get this error 我得到这个错误
org.hibernate.HibernateException: No CurrentSessionContext configured!
org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:542)
You must set your hibernate.current_session_context_class in your hibernate.xml file. 您必须在hibernate.xml文件中设置hibernate.current_session_context_class。
Refer to the following: http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html#configuration-j2ee-currentsession 请参阅以下内容: http : //docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html#configuration-j2ee-currentsession
在cfg文件中有此条目。
<property name="hibernate.current_session_context_class">thread</property>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.