代码改变世界

hibernate错误记录

2011-06-08 14:57  hanwesley  阅读(479)  评论(0编辑  收藏  举报

1) There is no ID/IDREF binding for IDREF 'sessionFactory'.

多个配置文件imprort的时候,属性引用最好采用

<bean id="groupDAO" class="com.magic.schedule.dal.impl.hibernate.GroupDAOImpl">

    <property name="sessionFactory" ref="sessionFactory"/> 而不是 <property name="sessionFactory">  <ref local="sessionFactory" />  </property> 

</bean>

2)org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here at org.springframework.orm.hibernate3.SpringSessionContext.currentSession(SpringSessionContext.java:63) at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:687)

需要增加配置 <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/> //如此配置需要增加cglib