0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Mybatis-Generator

Posted at
  • 実行構成ファイル(generatorConfig.xml)の作成メモ
generationConfig.xml
<?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="context1" targetRuntime="MyBatis3">
        <!-- コメント生成の抑制 -->
        <commentGenerator>
            <property name="suppressAllComments" value="true" />
        </commentGenerator>
        <!-- スキーマ情報を取得する DB への接続設定 -->
        <jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
            connectionURL="jdbc:mysql://localhost:3306/localdb" userId="root"
            password="root">
        </jdbcConnection>
        <!-- SELECT結果等を格納するドメインモデルを生成する設定 -->
        <javaModelGenerator
            targetPackage="com.example.demo"
            targetProject="mybatis-generator/src/main/java">
            <property name="enableSubPackages" value="true" />
            <property name="trimStrings" value="true" />
        </javaModelGenerator>
        <!-- SQL設定が記述された XML を生成する設定 -->
        <sqlMapGenerator targetPackage="com.example.demo"
            targetProject="mybatis-generator/src/main/resources">
            <property name="enableSubPackages" value="true" />
        </sqlMapGenerator>
        <!-- マッパークラスを生成する設定 -->
        <javaClientGenerator type="XMLMAPPER"
            targetPackage="com.example.demo"
            targetProject="mybatis-generator/src/main/java">
            <property name="enableSubPackages" value="true" />
        </javaClientGenerator>
        <!-- コードを生成するテーブルを指定 -->
        <table schema="localdb" tableName="user_info" />
        <table schema="localdb" tableName="code_master" />
    </context>
</generatorConfiguration>

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?