iBATIS的自动代码生成工具Abator在Eclipse的应用
创始人
2024-04-16 06:00:26
0

iBATIS的自动代码生成工具Abator在Eclipse的应用呢首先就是iBATIS的准备:

1、获得 iBATIS

http://ibatis.apache.org/abator.html   

Eclipse可以自动的进行Update获取此Plugin,官方的安装步骤.   
    
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.   
  
If you've not already installed Abator, then you can use the built in Eclipse install support by following these steps:   
  
Take the "Help﹥Software Updates﹥Find and Install" Menu Option    

Select the "Search for new features to install" radio button, press "Next"   
 
Press the "New Remote Site" button    

Enter the following information:    

Name:    

Abator for Eclipse Update Site   
 
URL:    

http://ibatis.apache.org/tools/abator   
 
Press OK    

Check the box next to "Abator for Eclipse Update Site"  
 
Follow the remainder of the install wizard   
 
2、安装好后将在New菜单中看到一个新的文件类型Abator for iBATIS Configuration File,此是Abator的配置文件,配置文件的详细说明见http://ibatis.apache.org/docs/tools/abator/   
  
3、新建一个配置文件,进行修改,根据自己的实际需求进行修改  
 
关键点:   

1)jdbcconnection,按照一般的配置即可,需要说明的是它需要指定访问JdbcDriver的classPathEntry,对于MsSqlServer而言,要将这三个jar文件均包含在内,否则会出现jdbc访问错误。   

2)配置三个Pakage   

3)配置表,此处需说明的是对于MsSqlServer不能写TableSchema,我初次指定TableSchema,结果未找到对应的表  
 
简单的配置如下,复杂的见配置文件的详细说明。示例配置文件如下  

  1. ﹤abatorConfiguration﹥     
  2.   ﹤abatorContext﹥         
  3.     ﹤jdbcConnection driverClass="com.microsoft.jdbc.sqlserver.SQLServerDriver"     
  4.         connectionURL="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=whm;SelectMethod=cursor"     
  5.         userId="sa"     
  6.         password="sa"﹥     
  7.       ﹤classPathEntry location="C:/Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/mssqlserver.jar" /﹥     
  8.       ﹤classPathEntry location="C:/Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/msutil.jar" /﹥     
  9.       ﹤classPathEntry location="C:/Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/msbase.jar" /﹥     
  10.     jdbcConnection﹥     
  11.      
  12.     ﹤javaModelGenerator targetPackage="com.dwerp.itatis.domain" targetProject="BhbManage" /﹥     
  13.     ﹤sqlMapGenerator targetPackage="com.dwerp.itatis.persistence.xml" targetProject="BhbManage" /﹥     
  14.     ﹤daoGenerator type="IBATIS" targetPackage="com.dwerp.itatis.persistence.sqlmapdao" targetProject="BhbManage" /﹥     
  15.      
  16.     ﹤table tableName="BHBGL"﹥     
  17.           
  18.     table﹥     
  19.      
  20.   ﹤/abatorContext﹥     
  21. ﹤/abatorConfiguration﹥    

4、右键单击配置文件,点击Generate iBatis Artifacts,生成文件。

iBATIS的自动代码生成工具Abator在Eclipse里的应用就向你介绍到这里,希望对你有所帮助。

【编辑推荐】

  1. iBATIS的优、缺点及注意事项浅谈
  2. iBATIS操作Blob与Clob浅析
  3. iBATIS读写CLOB数据浅析
  4. iBATIS操作CLOB字段实战浅析
  5. iBATIS for Eclipse设置浅析

相关内容

热门资讯

如何允许远程连接到MySQL数... [[277004]]【51CTO.com快译】默认情况下,MySQL服务器仅侦听来自localhos...
如何利用交换机和端口设置来管理... 在网络管理中,总是有些人让管理员头疼。下面我们就将介绍一下一个网管员利用交换机以及端口设置等来进行D...
施耐德电气数据中心整体解决方案... 近日,全球能效管理专家施耐德电气正式启动大型体验活动“能效中国行——2012卡车巡展”,作为该活动的...
20个非常棒的扁平设计免费资源 Apple设备的平面图标PSD免费平板UI 平板UI套件24平图标Freen平板UI套件PSD径向平...
德国电信门户网站可实时显示全球... 德国电信周三推出一个门户网站,直观地实时提供其安装在全球各地的传感器网络检测到的网络攻击状况。该网站...
为啥国人偏爱 Mybatis,... 关于 SQL 和 ORM 的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行...
《非诚勿扰》红人闫凤娇被曝厕所... 【51CTO.com 综合消息360安全专家提醒说,“闫凤娇”、“非诚勿扰”已经被黑客盯上成为了“木...
2012年第四季度互联网状况报... [[71653]]  北京时间4月25日消息,据国外媒体报道,全球知名的云平台公司Akamai Te...