美文网首页
使用Mybatis-Generator自动生成Dao代码

使用Mybatis-Generator自动生成Dao代码

作者: peng66cheng | 来源:发表于2017-05-29 22:12 被阅读173次

    Mybatis属于半自动ORM,在使用这个框架中,工作量最大的就是书写Mapping的映射文件,由于手动书写很容易出错,我们可以利用Mybatis-Generator来帮我们自动生成文件。

    Mybatis-Generator官网:http://www.mybatis.org/generator/index.html

    Mybatis-Generator github:https://github.com/mybatis/generator 

    本例demo代码地址:https://github.com/peng66cheng/ssmDemo

    1、dao工程中 增加依赖

    2、修改配置文件:generatorConfig.xml

    3、在项目中运行mvn命令,即可生成代码。

    4、代码生成结果如下:

    相关文章

      网友评论

          本文标题:使用Mybatis-Generator自动生成Dao代码

          本文链接:https://www.haomeiwen.com/subject/gpjlfxtx.html