eclipse 配置ibtais插件

来源:互联网 发布:人工智能三大流派 编辑:程序博客网 时间:2024/05/14 03:26

eclipse 远程安装ibatis插件 自动生成model、map、dao 类。

 

 一:安装ibatis插件 步骤如下

eclipse->Help>Install New Software>Find and Install->add->
 (name:ibatis ,URL:http://ibatis.apache.org/tools/abator )
 ->OK->Abator for Eclipse Update Site->OK  如下图

 

 点击add 弹出下图 输入地址 点击ok

 

选择一个 点击next直到结束

 

插件安装完了  我们还要在项目新建个文件 配置要自动生成哪些内容 我这里包括model、map、dao 类。

二.建立一个项目

新建一个Eclipse项目,输入名字,然后选择文件>新建>ABator for iBatis configuration File,选择Location,并且键入File Name:abatorCsonfig.xml。

点击“完成”,Eclipse会在程序根目录下建立abatorCsonfig.xml文件,打开编辑它,内容如下:

Xml代码  收藏代码
  1. <?xml version="1.0" encoding="UTF-8" ?>  
  2. <!DOCTYPE abatorConfiguration PUBLIC "-//Apache Software Foundation//  
  3. DTD Abator for iBATIS Configuration 1.0//EN"   
  4. "http://ibatis.apache.org/dtd/abator-config_1_0.dtd" >  
  5. <abatorConfiguration>  
  6.     <abatorContext>  
  7. <!--我的配置 <jdbcConnection driverClass="oracle.jdbc.OracleDriver"  
  8. connectionURL="jdbc:oracle:thin:@localhost:1521:ORCL"   
  9. userId="username" password="password">  
  10. <classPathEntry location="D:\workspace\lib\classes12.jar" />  
  11. </jdbcConnection>-->  
  12. <jdbcConnection driverClass="驱动" connectionURL="数据库URL"   
  13. userId="用户名" password="密码" >  
  14.       <classPathEntry location="数据库驱动jar包" />  
  15.     </jdbcConnection>  
  16. <!--我的配置 <javaModelGenerator targetPackage="com.portal.model"      
  17. targetProject="extDemo/src"  />-->  
  18.     <javaModelGenerator targetPackage="model层包路径" targetProject="src路径" />  
  19.     <sqlMapGenerator targetPackage="map层包路径" targetProject="src路径" />  
  20.     <daoGenerator targetPackage="dao层包路径" targetProject="src路径" type="IBATIS" />  
  21.   
  22.    <!-- 我的配置<table tableName="tb_rydm" />  
  23.    <table tableName="tb_bmzdm" />-->  
  24.     <table schema="表名" tableName="表名">  
  25.     </abatorContext>  
  26. </abatorConfiguration>  
 

最后右键运行配置文件 如下图

 

完成生成 如下图


原创粉丝点击