[英]getting hibernate session error in java
我有這個
SessionFactory sessionFactory = new AnnotationConfiguration()
.configure("com/vaannila/service/hibernate.cfg.xml")
.buildSessionFactory();
Session session = sessionFactory.getCurrentSession();
我得到這個錯誤
org.hibernate.HibernateException: No CurrentSessionContext configured!
org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:542)
您必須在hibernate.xml文件中設置hibernate.current_session_context_class。
請參閱以下內容: 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.