최대 절전 모드를 처음 사용합니다.org.hibernate.HibernateException : 활성 트랜잭션 없이는 get이 유효하지 않습니다.
- 자동으로 생성있는 hibernate.cfg.xml (넷빈즈 마법사) 자동 HibernateUtil.java 을 만들어
- 데이터베이스하지만 점점 오류에서 객체를 얻기 위해 노력 주석
와
Exception in thread "pool-1-thread-1" org.hibernate.HibernateException: get is not valid without active transaction
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297)
개체 받기 :
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
CallInfo ci = (CallInfo) session.get(CallInfo.class, ucid);
있는 hibernate.cfg.xml
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/sochi_feedback</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
<property name="hibernate.current_session_context_class">thread</property>
get() 메서드를 호출하는 코드를 추가 할 수 있습니까 ?? –
@ShashankKadne'CallInfo ci = (CallInfo) session.get (CallInfo.class, ucid); ' – VextoR
'트랜잭션 tx = session.beginTransaction();을 추가하십시오. 이 줄 바로 앞과 작업이 끝날 때 "tx.commit();"을 호출하십시오. –