怎样在Eclipse中使用ibatis的自动代码生成工具Abator

  1. 1、获得   
  2.       http://ibatis.apache.org/abator.html   
  3.      Eclipse可以自动的进行Update获取此Plugin,官方的安装步骤.   
  4.     
  5. If you've already installed a prior version of Abator, simply run the Eclipse Install/Update tool and the new version will be found automatically.   
  6.   
  7. If you've not already installed Abator, then you can use the built in Eclipse install support by following these steps:   
  8.   
  9. Take the "Help>Software Updates>Find and Install" Menu Option    
  10. Select the "Search for new features to install" radio button, press "Next"    
  11. Press the "New Remote Site" button    
  12. Enter the following information:    
  13. Name:    
  14. Abator for Eclipse Update Site    
  15. URL:    
  16. http://ibatis.apache.org/tools/abator    
  17. Press OK    
  18. Check the box next to "Abator for Eclipse Update Site"    
  19. Follow the remainder of the install wizard    
  20. 2、安装好后将在New菜单中看到一个新的文件类型Abator for iBATIS Configuration File,此是Abator的配置文件,配置文件的详细说明见http://ibatis.apache.org/docs/tools/abator/   
  21.   
  22. 3、新建一个配置文件,进行修改,根据自己的实际需求进行修改   
  23. 关键点:   
  24. 1)jdbcconnection,按照一般的配置即可,需要说明的是它需要指定访问JdbcDriver的classPathEntry,对于MsSqlServer而言,要将这三个jar文件均包含在内,否则会出现jdbc访问错误。   
  25. 2)配置三个Pakage   
  26. 3)配置表,此处需说明的是对于MsSqlServer不能写TableSchema,我初次指定TableSchema,结果未找到对应的表   
  27. 简单的配置如下,复杂的见配置文件的详细说明。示例配置文件如下   
  28. <abatorConfiguration>  
  29.   <abatorContext>      
  30.     <jdbcConnection driverClass="com.microsoft.jdbc.sqlserver.SQLServerDriver"  
  31.         connectionURL="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=whm;SelectMethod=cursor"  
  32.         userId="sa"  
  33.         password="sa">  
  34.       <classPathEntry location="C:/Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/mssqlserver.jar" />  
  35.       <classPathEntry location="C:/Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/msutil.jar" />  
  36.       <classPathEntry location="C:/Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/msbase.jar" />  
  37.     jdbcConnection>  
  38.   
  39.     <javaModelGenerator targetPackage="com.dwerp.itatis.domain" targetProject="BhbManage" />  
  40.     <sqlMapGenerator targetPackage="com.dwerp.itatis.persistence.xml" targetProject="BhbManage" />  
  41.     <daoGenerator type="IBATIS" targetPackage="com.dwerp.itatis.persistence.sqlmapdao" targetProject="BhbManage" />  
  42.   
  43.     <table tableName="BHBGL">  
  44.        
  45.     table>  
  46.   
  47.   abatorContext>  
  48. abatorConfiguration>  
  49.   
  50.   
  51. 4、右键单击配置文件,点击Generate iBatis Artifacts,生成文件。  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值