2

I use mybatis generator with maven in eclipse.

I want to add comments on the generated classes, fields and methods.

I configured coomentGenerator as below but it does not add any comments.

<commentGenerator>
 <property name="suppressAllComments" value="false" />
 <property name="addRemarkComments" value="true" />
</commentGenerator>

My DB is oracle, and tables and fields have comments.

I confirmed that all_tab_comments, all_col_comments have comments for my tables and columns.

I use mybatis-generator-maven-plugin with version 1.3.5

JonathanDavidArndt
  • 2,518
  • 13
  • 37
  • 49

1 Answers1

2

Oracle's JDBC driver does not return remarks by default. See this page for details: https://docs.oracle.com/database/121/JJDBC/oraperf.htm#JJDBC28785

To enable it for the generator, you must add a connection property to your <jdbcConnection>

<property name="remarksReporting" value="true"/>

Jeff Butler
  • 991
  • 6
  • 11
  • Not work as well. context.addProperty("remarksReporting", Boolean.TRUE.toString()); JDBCConnectionConfiguration jdbcConnectionConfiguration = new JDBCConnectionConfiguration(); – Gank Apr 05 '18 at 02:44
  • 1
    Add it as a property to the jdbcConnection, not the context. – Jeff Butler Apr 05 '18 at 09:56
  • Thanks! I sovled by moving the mybatis generate pom source to my project, change the jdbcConnection connet code, then it works.@Jeff Butler – Gank Apr 06 '18 at 06:16