• 使用eclipse插件mybatis generator来自动生成实体类及映射文件


    <?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>
        <classPathEntry
            <!-- 驱动的绝对路径 -->
            location="D:maven
    epositoryorgpostgresqlpostgresql9.3-1103-jdbc41postgresql-9.3-1103-jdbc41.jar" />
        <context id="context1">
            <commentGenerator>
                <property name="suppressAllComments" value="true" /><!-- 是否取消注释 -->
                <property name="suppressDate" value="false" /> <!-- 是否生成注释代时间戳 -->
            </commentGenerator>
            <jdbcConnection driverClass="org.postgresql.Driver"
                connectionURL="jdbc:postgresql://192.168.1.1:14132/dev" userId="userId"
                password="password" />
                
            <!-- targetPackage是目标包名,  targetProject是包所在的位置-->
            <!-- javaModelGenerator生成的是实体类,  sqlMapGenerator生成的是映射文件,  javaClientGenerator生成的是dao -->
            <javaModelGenerator targetPackage="auto.dto"
                targetProject="testProjectsrcmainjava" />
            <sqlMapGenerator targetPackage="auto.xml"
                targetProject="testProjectsrcmainjava" />
            <javaClientGenerator targetPackage="auto.dao"
                targetProject="testProjectsrcmainjava" type="XMLMAPPER" />
                
            <!-- domainObjectName是表对应的实体类名,  tableName是对应的表名-->
            <!-- table可以配置多个,enable*几个参数是为了自动生成一些额外的sql操作,可以关闭-->
            <table domainObjectName="StudentInfoDto" tableName="student_info"
                enableCountByExample="false" enableUpdateByExample="false"
                enableDeleteByExample="false" enableSelectByExample="false"
                selectByExampleQueryId="false">
            </table>
            <table domainObjectName="TeacherInfoDto" tableName="teacher_info"
                enableCountByExample="false" enableUpdateByExample="false"
                enableDeleteByExample="false" enableSelectByExample="false"
                selectByExampleQueryId="false">
            </table>
        </context>
    </generatorConfiguration>
  • 相关阅读:
    在Ubuntu中通过update-alternatives切换软件版本
    SCons: 替代 make 和 makefile 及 javac 的极好用的c、c++、java 构建工具
    mongodb 的使用
    利用grub从ubuntu找回windows启动项
    How to Repair GRUB2 When Ubuntu Won’t Boot
    Redis vs Mongo vs mysql
    java script 的工具
    python 的弹框
    how to use greendao in android studio
    python yield的终极解释
  • 原文地址:https://www.cnblogs.com/ysgcs/p/7524630.html
Copyright © 2020-2023  润新知