The database schema extraction is performed by the extract-metadata goal of the dbmetadata-maven-plugin,
a Maven plugin provided by Jaxio.
This plugin connects to a relational database using JDBC, retrieves the database schema metadata and write it
into an XML file named metadata.xml.
Note
The metadata file produced by the dbmetadata plugin is not meant to be edited
manually. If you need to change some settings, you should either
change your database schema or use Celerio’s configuration file.
While pretty straightforward the schema extraction may take several minutes on large database schemas
(e.g. more than 200 tables). To prevent useless extraction , the simplest approach is to declare a Maven profile
dedicated to database extraction and activate it only when needed (i.e. each time you modify the database schema).
The metadata.xml file produced by this plugin is used by Celerio’s generate goal.
Details of dbmetadata-maven-plugin
Full name
name: com.jaxio.celerio:dbmetadata-maven-plugin
goal: extract-metadata
maven phase: generate-sources
Attributes
skip
expression: celerio-maven-plugin.skip
default value: false
description: Should the database meta data extraction be skipped ?
This is a common pattern in Maven, where you can skip plugins using profiles to fully adapt your build.
jdbcDriver
expression: jdbc.driver
description: Set the JDBC driver class
example: org.postgresql.Driver
jdbcUrl
expression: jdbc.url
description: Set the JDBC url to connect to your database. Make sure that you connect with enough privileges to access the meta data information.
example: jdbc:h2:~/.h2/sampledatabase
jdbcUser
expression: jdbc.user
description: Set the JDBC user, this user needs to have the privilege to access the database metadata.
jdbcPassword
expression: jdbc.password
description: Set the JDBC password.
jdbcCatalog
expression: jdbc.catalog
description: Set the JDBC catalog.
jdbcOracleRetrieveRemarks
expression: jdbc.oracleRetrieveRemarks
default value: false
description: Should the Oracle remarks be retrieved ? Please note that this will impact the speed of the reverse engineering of your database.
jdbcOracleRetrieveSynonyms
expression: jdbc.oracleRetrieveSynonyms
default value: true
description: Should the synonyms be retrieved ?
jdbc.reverseIndexes
expression: jdbc.reverseIndexes
default value: true
description: When false, disable completely reverse of indexes. Can be useful when reversing large database full of data as reversing indexes can be slow.
jdbc.reverseOnlyUniqueIndexes
expression: jdbc.reverseOnlyUniqueIndexes
default value: true
description: When true, reverse only indexes for unique values; when false, reverse indexes regardless of whether unique or not. Can be useful when reversing large database full of data as reversing indexes can be slow.
jdbcReverseViews
expression: jdbc.reverseViews
default value: false
description: Should this plugin also reverse VIEWS?
description: The fully qualified name of the XML file created by this plugin.
jdbcTableNamePatterns
type: List
default value: %
description: In case DB reverse is too slow you may use this configuration to filter out tables during DB reverse phase. By default Celerio reverses all the tables and you can filter them out afterward, during code generation phase.
Simple Usage
In your pom.xml, declare as properties the necessary expressions that the plugin needs to connect to your database and reverse it.
Then create a dedicated profile to execute the plugin.