sessionFactory or hibernateTemplate is required错误

来源:互联网 发布:linux下安装多个jdk 编辑:程序博客网 时间:2024/04/30 14:23

启动TOMCAT服务器时就老是报错.
.........
java.lang.IllegalArgumentException: sessionFactory or hibernateTemplate is required


原因及解决:

xxServiceImpl  extends HibernateDaoSupport .改正后运行正常,


(应该是xxDaoImpl extends HibernateDaoSupport)

xxServiceImpl 不用继承HibernateDaoSupport

 

<aop:config>
  <aop:advisor
   pointcut="execution(* cn.gzydt..*.service.*.*(..)) or execution(* cn.gzydt.common.hbmdao.*.*(..))"
   advice-ref="txAdvice" />  
 </aop:config>

 <tx:advice id="txAdvice"  transaction-manager="transactionManager">
  <tx:attributes>
   <tx:method name="save"  rollback-for="Exception"/>
   <tx:method name="delete"  rollback-for="Exception"/>
   <tx:method name="update"  rollback-for="Exception"/>
   <tx:method name="save*"  rollback-for="Exception"/>
   <tx:method name="add*"  rollback-for="Exception"/>
   <tx:method name="update*"  rollback-for="Exception"/>
   <tx:method name="modify*"  rollback-for="Exception"/>
   <tx:method name="delete*"  rollback-for="Exception"/>
   <tx:method name="start*"  rollback-for="Exception"/>
   <tx:method name="stop*"  rollback-for="Exception"/>
   <tx:method name="assign*" rollback-for="Exception"/>
   <tx:method name="*N" propagation="NEVER"/>
   <tx:method name="*" />
   
  </tx:attributes>
 </tx:advice> 
 <bean id="transactionManager"
  class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  <property name="sessionFactory">
   <ref bean="cipSessionFactory" />
  </property>
 </bean>

还要记得配上那一段