Spring boot + mybatis + oracle Code Generator

In the pom file add-dependent:

<build>
    <plugins>
        <!--逆向工程-->
        <plugin>
            <groupId>org.mybatis.generator</groupId>
            <artifactId>mybatis-generator-maven-plugin</artifactId>
            <version>1.3.2</version>
            <configuration>
                <verbose>true</verbose>
                <overwrite>false</overwrite>
            </configuration>
            <dependencies>
                <!--oracle-->
                <dependency>
                    <groupId>cn.easyproject</groupId>
                    <artifactId>ojdbc6</artifactId>
                    <version>12.1.0.2.0</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

Join the configuration file:

<?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>

    <context id="oraclegenerator" targetRuntime="MyBatis3Simple">

        <commentGenerator>
            <property name="suppressDate" value="true"/>
            <!-- 是否去除自动生成的注释 true:是 : false:否 -->
            <property name="suppressAllComments" value="true"/>
        </commentGenerator>

        <jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver"
                        connectionURL="jdbc:oracle:thin:@127.0.0.1:1521:orcl"
                        userId="scott"
                        password="root"/>

        <javaModelGenerator targetPackage="com.frost.entity" targetProject="src/main/java">
            <property name="enableSubPackages" value="true"/>
            <property name="trimStrings" value="true"/>
        </javaModelGenerator>

        <!--生成映射文件存放位置-->
        <sqlMapGenerator targetPackage="mapper" targetProject="src/main/resources">
            <property name="enableSubPackages" value="true"/>
        </sqlMapGenerator>

        <javaClientGenerator targetPackage = "com.frost.mapper" type = "XMLMAPPER" targetProject = "the src / main / Java"> 
            <-! targetPackage on the basis regenerates the database schema according to one package, the final discharge generated classes in this package, defaults to false -> 
            <Property name = "enableSubPackages" = value "to true" /> 
        </ javaClientGenerator> 

        <Table tableName = "the STUDENT" /> 
    </ context> 
</ generatorConfiguration>

run:

 

 The last sign of success is:

 

 

details make a difference!

 

Guess you like

Origin www.cnblogs.com/xdtg/p/11724021.html