myBatis Generator

156 views
Skip to first unread message

John Sok

unread,
Oct 19, 2021, 1:01:28 PM10/19/21
to mybatis-user
Hi All,

 We have a generatorConfig.xml that works but if we change targetRuntime from "MyBatis3DynamicSql" to "MyBatis3" ( or "Mybatis3Simple") it stops to work with a cryptic (at least for us) message:

$ java -jar mybatis-generator-core-1.4.0.jar  -configFile generatorConfig.xml  -overwrite
Invalid configuration.  Details follow...
SqlMapGeneratorConfiguration is required for context testGenerator


$ cat generatorConfig.xml
<!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="postgresql-42.2.24.jar" />
  <context id="testGenerator" targetRuntime="MyBatis3Simple" defaultModelType="flat">

    <property name="suppressAllComments" value="true" />         
    <property name="suppressDate" value="true" />

    <property name="javaFileEncoding" value="utf-8" />

    <property name="schema" value="app" />

    <jdbcConnection driverClass="org.postgresql.Driver"
                    connectionURL="jdbc:postgresql://192.168.88.106:5432/test"
                    userId="test"
                    password="*******">
    </jdbcConnection>


    <!-- Pojo -->
    <javaModelGenerator targetPackage="example.model" targetProject="src/main/java/" />

    <!-- Dao -->
    <javaClientGenerator targetPackage="example.mapper" targetProject="src/main/java/"  type="XMLMAPPER" />


    <table tableName="clients" />

  </context>

</generatorConfiguration>


what are we doing wrong?
Thanks !



John Sok

unread,
Oct 19, 2021, 1:16:00 PM10/19/21
to mybatis-user
Resolved, at least for now. thanks


$ cat  generatorConfig.xml
<!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="postgresql-42.2.24.jar" />
  <context id="testGenerator" targetRuntime="MyBatis3Simple" defaultModelType="flat">

    <property name="suppressAllComments" value="true" />         
    <property name="suppressDate" value="true" />

    <property name="javaFileEncoding" value="utf-8" />

    <property name="schema" value="app" />

    <jdbcConnection driverClass="org.postgresql.Driver"
                    connectionURL="jdbc:postgresql://192.168.88.106:5432/test"
                    userId="test"
                    password="***">
    </jdbcConnection>


    <!-- Pojo -->
    <javaModelGenerator targetPackage="example.model" targetProject="src/main/java/" >
           <property name="enableSubPackages" value="true" />
            <property name="trimStrings" value="true" />
    </javaModelGenerator>

    <sqlMapGenerator targetPackage="entity-mapper"  targetProject="src/main/resources/">
            <property name="enableSubPackages" value="true" />
    </sqlMapGenerator>

    <!-- Dao -->
    <javaClientGenerator targetPackage="example.dao" targetProject="src/main/java/"  type="XMLMAPPER" >
            <property name="enableSubPackages" value="true" />
    </javaClientGenerator>


    <table tableName="clients" />

  </context>

</generatorConfiguration>




El dia dimarts, 19 d’octubre de 2021 a les 19:01:28 UTC+2, John Sok va escriure:

Peter Cao

unread,
Nov 22, 2021, 5:17:33 AM11/22/21
to mybati...@googlegroups.com
Hi guys, I found a very cool mybatis generator at https://www.spdycoding.com
Please check it out.

John Sok <simeo...@gmail.com>于2021年10月20日 周三01:16写道:
--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/4c334ed4-332f-4e6c-9fe3-d48497c89e8an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages