你的位置:首页 > 软件开发 > Java > SpringMVC与mybatis整合

SpringMVC与mybatis整合

发布时间:2016-05-11 14:00:17
一、逆向工程生成基础信息<??><!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" &qu ...

SpringMVC与mybatis整合

一、逆向工程生成基础信息

<??><!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"><generatorConfiguration>  <context id="testTables" targetRuntime="MyBatis3">    <commentGenerator>      <!-- 是否去除自动生成的注释 true:是 : false:否 -->      <property name="suppressAllComments" value="true" />    </commentGenerator>    <!--数据库连接的信息:驱动类、连接地址、用户名、密码 -->    <jdbcConnection driverClass="com.mysql.jdbc.Driver"      connectionURL="jdbc:mysql://localhost:3307/mybatis" userId="root"      password="jalja">    </jdbcConnection>    <!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL 和       NUMERIC 类型解析为java.math.BigDecimal -->    <javaTypeResolver>      <property name="forceBigDecimals" value="false" />    </javaTypeResolver>    <!-- targetProject:生成PO类的位置 -->    <javaModelGenerator targetPackage="com.jalja.springmvc_mybatis.model.pojo"      targetProject=".\src">      <!-- enableSubPackages:是否让schema作为包的后缀 -->      <property name="enableSubPackages" value="false" />      <!-- 从数据库返回的值被清理前后的空格 -->      <property name="trimStrings" value="true" />    </javaModelGenerator>    <!-- targetProject:mapper映射文件生成的位置 -->    <sqlMapGenerator targetPackage="com.jalja.springmvc_mybatis.mapper"       targetProject=".\src">      <!-- enableSubPackages:是否让schema作为包的后缀 -->      <property name="enableSubPackages" value="false" />    </sqlMapGenerator>    <!-- targetPackage:mapper接口生成的位置 -->    <javaClientGenerator type="      targetPackage="com.jalja.springmvc_mybatis.mapper"       targetProject=".\src">      <!-- enableSubPackages:是否让schema作为包的后缀 -->      <property name="enableSubPackages" value="false" />    </javaClientGenerator>    <!-- 指定数据库表 -->    <table tableName="items"></table>    <table tableName="orders"></table>    <table tableName="orderdetail"></table>    <table tableName="user"></table>  </context></generatorConfiguration>

原标题:SpringMVC与mybatis整合

关键词:Spring

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录