Class RevengMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.tentackle.maven.AbstractTentackleMojo
org.tentackle.maven.plugin.sql.RevengMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="reveng", aggregator=true, threadSafe=true) public class RevengMojo extends AbstractTentackleMojo
Reverse-engineers tables of an existing database into Tentackle model source files.

Given a JDBC connection and a list of table names, this goal introspects each table's columns, indexes and foreign keys (via org.tentackle.sql.metadata) and writes one model-source file per table into outputDir, in exactly the plain-text format that tentackle-wizard:pdo's -DbatchDir batch mode already reads. It does not generate any Java code itself — running pdo on the output directory is the second, separate step:

mvn tentackle-sql:reveng -Dtentackle.reveng.tables=CUSTOMER,ORDER_ITEM -Dtentackle.reveng.url=jdbc:... -Dtentackle.reveng.user=...
mvn tentackle-wizard:pdo -DbatchDir=target/reveng-model

Foreign keys become plain, non-composite object relations using integrity; composite (aggregate) semantics cannot be inferred from schema metadata and are left for the user to add by hand to the generated files before running pdo. A foreign key referencing a table that is not part of the same reveng run is left as a plain attribute (with an explanatory comment) rather than a relation, since the batch model cannot resolve a relation to an entity that isn't among the files being loaded.

Author:
harald
  • Constructor Details

    • RevengMojo

      public RevengMojo()
  • Method Details

    • executeImpl

      public void executeImpl() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Specified by:
      executeImpl in class AbstractTentackleMojo
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException