让ANT帮助自动生成数据库表

1.在WEB.XML中必须有以下内容
  1. <context-param>
  2. <param-name>contextConfigLocation</param-name>
  3. <param-value>/WEB-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml</param-value>
  4. </context-param>
  5. <listener>
  6. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  7. </listener>
2.在SRC的目录下应该有ApplicationContext-common.xml(让其自动生成SessionFactory进行生成表的管理?)
  1. <?xmlversion="1.0"encoding="UTF-8"?>
  2. <beansxmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:aop="http://www.springframework.org/schema/aop"
  5. xmlns:tx="http://www.springframework.org/schema/tx"
  6. xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  7. http://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-2.0.xsd
  8. http://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
  9. <!--配置sessionFactory-->
  10. <beanid="sessionFactory"class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  11. <propertyname="configLocation">
  12. <value>classpath:hibernate.cfg.xml</value>
  13. </property>
  14. </bean>
  15. <!--配置事务管理器-->
  16. <beanid="transactionManager"class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  17. <propertyname="sessionFactory">
  18. <reflocal="sessionFactory"/>
  19. </property>
  20. </bean>
  21. <!--配置事务特性-->
  22. <tx:adviceid="txAdvice"transaction-manager="transactionManager">
  23. <tx:attributes>
  24. <tx:methodname="add*"propagation="REQUIRED"/>
  25. <tx:methodname="del*"propagation="REQUIRED"/>
  26. <tx:methodname="update*"propagation="REQUIRED"/>
  27. <tx:methodname="*"read-only="true"/>
  28. </tx:attributes>
  29. </tx:advice>
  30. <!--配置那些类的方法进行事务管理-->
  31. <aop:config>
  32. <aop:pointcutid="allManagerMethod"expression="execution(*com.bjsxt.oa.manager.*.*(..))"/>
  33. <aop:advisoradvice-ref="txAdvice"pointcut-ref="allManagerMethod"/>
  34. </aop:config>
  35. </beans>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值