The <classPathEntry> Element

The <classPathEntry> element is used to add classpath locations to the classpath of the MyBatis Generator (MBG) run. The <classPathEntry> element is an option child element of the <generatorConfiguration> element. MBG loads classes from these locations in these instances:

  • When loading the JDBC driver for database introspection
  • When loading root classes in the JavaModelGenerator to check for overridden methods

This element is optional and is not required if you setup the classpath externally to MBG (e.g. with the -cp argument of the java command

Important Note: these locations are NOT used when loading classes that extend one of MBG's classes or implement one of MBG's interfaces. In those cases you must add your external classes to the runtime classpath in the same way you add MBG to the classpath (e.g. with the -cp argument of the java command).

Required Attributes

Attribute Description
location The full path name of a JAR/ZIP file to add to the classpath, or a directory to add to the classpath.

Optional Attributes

None

Child Elements

None

Example

This element specifies the location of a DB2 JDBC driver:

<classPathEntry location="/Program Files/IBM/SQLLIB/java/db2java.zip" />