The <ignoreColumnsByRegex> Element

The <ignoreColumnsByRegex> element is used to tell MyBatis Generator (MBG) to ignore a set of columns in an introspected table - the set is determined by matching against a regular expression specified in this element. No generated SQL will refer to the ignored columns, and no properties will be generated for the ignored columns in the model objects. This element is an optional child element of the <table> element.

You can specify exceptions to the pattern through use of an <except> element.

Required Attributes

Attribute Description
pattern The regular expression used to match column names. The regular expression engine is the standard java.util.regex.Pattern engine.

Optional Attributes

None

Child Elements

Example

This example tells MyBatis to ignore every column in the Foo table that begins with the characters "col" (case-insensitive) except for "col01" and "col13".

    <table tableName="Foo">
      <ignoreColumnsByRegex pattern="(?i)col.*">
        <except column="col01"/>
        <except column="col13"/>
      </ignoreColumnsByRegex>
    </table>