Search code examples
oracle-databasemybatismybatis-generator

Mybatis generator addRemarkComments for oracle not working


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


Solution

  • 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"/>