ibatis自动生成工具ibator及配置文件示例

ibator安装很容易,有2种方式,在线和离线,在网上均有大把资料,使用也很简单,不再赘述。只提供ibator的配置文件ibatorConfig.xml基本内容以供参考:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE ibatorConfiguration PUBLIC "-//Apache Software Foundation//DTD Apache iBATIS Ibator Configuration 1.0//EN" "http://ibatis.apache.org/dtd/ibator-config_1_0.dtd" >
<!-- ibator自动生成javabean和dao配置文件 -->
<ibatorConfiguration >
<!-- jdbc驱动包绝对位置 -->
<classPathEntry location="D:\Workspaces\MyEclipse 10\tracesource\WebRoot\WEB-INF\lib\mysql-connector-java-5.0.7-bin.jar" />
  <ibatorContext id="tracesource" >
    <!-- 连接字符串 -->
    <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/tracevegetables" userId="root" password="root" />
    <!-- javabean包位置 -->
    <javaModelGenerator targetPackage="com.yanglong.model" targetProject="tracesource" />
    <!-- sqlmap位置 -->
    <sqlMapGenerator targetPackage="com.yanglong.model" targetProject="tracesource" />
    <!-- dao位置 -->
    <daoGenerator targetPackage="com.yanglong.dao" targetProject="tracesource" type="spring" />
    <!-- 映射表 -->
    <table tableName="cfg_pri_role" domainObjectName="CfgPriRole"/>
    <table tableName="cfg_user_role" domainObjectName="CfgUserRole"/>
    <table tableName="plant_fertilize_log" domainObjectName="FertilizeLog"/>
    <table tableName="plant_info" domainObjectName="PlantInfo"/>
    <table tableName="plant_medicine_log" domainObjectName="MedicineLog"/>
    <table tableName="plant_soil_log" domainObjectName="SoilLog"/>
    <table tableName="plant_water_log" domainObjectName="WaterLog"/>
    <table tableName="planter_info" domainObjectName="PlanterInfo"/>
    <table tableName="pri_info" domainObjectName="PrivilegeInfo"/>
    <table tableName="reco_info" domainObjectName="FeedbackInfo"/>
    <table tableName="roler_info" domainObjectName="RolerInfo"/>
    <table tableName="store_environment_info" domainObjectName="StoreEnvirInfo"/>
    <table tableName="store_vegequality_info" domainObjectName="VegetablesQuality"/>
    <table tableName="transport_environment_info" domainObjectName="TransportEnvirInfo"/>
    <table tableName="user_info" domainObjectName="UserInfo"/>
    <table tableName="verify_info" domainObjectName="VerifyInfo"/>
  </ibatorContext>
</ibatorConfiguration>

附插件包及去注释版jar包。

猜你喜欢

转载自dr-yanglong.iteye.com/blog/1936559
今日推荐