国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Java > 正文

mybatis generator 配置 反向生成Entity簡單增刪改查(推薦)

2019-11-26 13:28:57
字體:
來源:轉載
供稿:網友

mybatis generator 配置 反向生成Entity簡單增刪改查實例代碼如下所示:

<?xml version="1.0" encoding="UTF-8"?>  <!DOCTYPE generatorConfiguration   PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"   "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"><generatorConfiguration> <!--數據庫驅動jar --> <classPathEntry location="D:/.m2/repository/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar" /> <context id="DB2Tables" targetRuntime="MyBatis3">  <!--去除注釋 -->  <commentGenerator>   <property name="suppressAllComments" value="true" />  </commentGenerator>  <!--數據庫連接 -->  <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://192.168.5.159:3306/數據庫名稱"   userId="用戶名" password="你懂得">  </jdbcConnection>  <!--默認false Java type resolver will always use java.math.BigDecimal if the database column is of type DECIMAL or NUMERIC. -->  <javaTypeResolver>   <property name="forceBigDecimals" value="false" />  </javaTypeResolver>  <!--生成實體類 指定包名 以及生成的地址 (可以自定義地址,但是路徑不存在不會自動創建 使用Maven生成在target目錄下,會自動創建) -->  <javaModelGenerator targetPackage="com.heaboy.包名.base.entity" targetProject="項目名">   <property name="enableSubPackages" value="false" />   <property name="trimStrings" value="true" />  </javaModelGenerator>  <!--生成SQLMAP文件 -->  <sqlMapGenerator targetPackage="com.heaboy.包名.mybatis" targetProject="項目名">   <property name="enableSubPackages" value="false" />  </sqlMapGenerator>  <!--生成Dao文件 可以配置 type="XMLMAPPER"生成xml的dao實現 context id="DB2Tables" 修改targetRuntime="MyBatis3" -->  <javaClientGenerator type="XMLMAPPER" targetPackage="com.heaboy.包名.base.dao" targetProject="項目名">   <property name="enableSubPackages" value="false" />  </javaClientGenerator>  <!--對應數據庫表 mysql可以加入主鍵自增 字段命名 忽略某字段等 -->  <table tableName="表名" domainObjectName="生成的實體名" enableCountByExample="false"   enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"   delimitIdentifiers="true">   <property name="useActualColumnNames" value="true" />  </table>  <table tableName="表名2" domainObjectName="生成的實體名2" enableCountByExample="false"   enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false">   <property name="useActualColumnNames" value="true" />  </table> </context></generatorConfiguration>

以上所述是小編給大家介紹的mybatis generator 配置 反向生成Entity簡單增刪改查,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對武林網網站的支持!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 陕西省| 宜宾县| 米易县| 花莲县| 徐闻县| 阿拉善左旗| 晋宁县| 文山县| 星座| 双城市| 安宁市| 游戏| 隆回县| 米林县| 敦煌市| 灵寿县| 永平县| 吴川市| 凤台县| 杂多县| 长武县| 肥西县| 桦南县| 尼玛县| 奉贤区| 南丰县| 景宁| 海伦市| 新建县| 苍溪县| 黑山县| 枞阳县| 余姚市| 望江县| 龙江县| 清水县| 四川省| 宁阳县| 军事| 双牌县| 阿巴嘎旗|