天天看点

java开源框架集成常见错误之No Hibernate Session bound to thread

错误描述:

No Hibernate Session bound to thread, and configuration does not allow creation of

non-transactional one here

原因:

<bean id="transactionManager"

class="org.springframework.orm.hibernate3.HibernateTransactionManager">

  <property name="sessionFactory" ref="sessionFactory"></property>

 </bean>

 <tx:advice id="txadvice" transaction-manager="transactionManager" >

  <tx:attributes>

   <tx:method name="*" propagation="REQUIRED" />

  </tx:attributes>

 </tx:advice>

 <aop:config>

  <aop:pointcut id="cut" expression="execution(* com.sale.dao..*.*

(..))" />

  <aop:advisor advice-ref="txadvice" pointcut-ref="cut" />

 </aop:config>

中的expression com.sale.dao..*.*(..)多写了个“s”不能找到

解决方法:

正确配置com.sales.dao..*.*(..)