Fork me on GitHub

hibernate-tools:hbm2ddl

Full name:

org.hibernate:hibernate-tools-maven-plugin:5.3.5-SNAPSHOT:hbm2ddl

Description:

Mojo to generate DDL Scripts from an existing database.

See https://docs.jboss.org/tools/latest/en/hibernatetools/html_single/#d0e4651

Attributes:

  • Requires a Maven project to be executed.
  • Binds by default to the lifecycle phase: generate-resources.

Optional Parameters

Name Type Since Description
<createCollectionForForeignKey> boolean - If true, a collection will be mapped for each foreignkey.
Default value is: true.
<createManyToOneForForeignKey> boolean - If true, a many-to-one association will be created for each foreignkey found.
Default value is: true.
<delimiter> String - Set the end of statement delimiter.
Default value is: ;.
<detectManyToMany> boolean - If true, tables which are pure many-to-many link tables will be mapped as such. A pure many-to-many table is one which primary-key contains exactly two foreign-keys pointing to other entity tables and has no other columns.
Default value is: true.
<detectOneToOne> boolean - If true, a one-to-one association will be created for each foreignkey found.
Default value is: true.
<detectOptimisticLock> boolean - If true, columns named VERSION or TIMESTAMP with appropriate types will be mapped with the appropriate optimistic locking corresponding to <version> or <timestamp>.
Default value is: true.
<format> boolean - Should we format the sql strings?
Default value is: true.
<haltOnError> boolean - Should we stop once an error occurs?
Default value is: true.
<outputDirectory> File - The directory into which the DDLs will be generated.
Default value is: ${project.build.directory}/generated-resources/.
<outputFileName> String - The default filename of the generated DDL script.
Default value is: schema.ddl.
<packageName> String - The default package name to use when mappings for classes are created.
<propertyFile> File - The name of a property file, e.g. hibernate.properties.
Default value is: ${project.basedir}/src/main/hibernate/hibernate.properties.
<revengFile> File - The name of a property file, e.g. hibernate.properties.
<revengStrategy> String - The class name of the reverse engineering strategy to use. Extend the DefaultReverseEngineeringStrategy and override the corresponding methods, e.g. to adapt the generate class names or to provide custom type mappings.
Default value is: org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy.
<schemaExportAction> SchemaExport$Action - The DDLs statements to create.
  • NONE: None - duh :P.
  • CREATE (default): Create only.
  • DROP: Drop only.
  • BOTH: Drop and then create.

Default value is: CREATE.
<targetTypes> Set - The type of output to produce.
  • DATABASE: Export to the database.
  • SCRIPT (default): Write to a script file.
  • STDOUT: Write to System.out.

Default value is: SCRIPT.

Parameter Details

<createCollectionForForeignKey>

If true, a collection will be mapped for each foreignkey.
  • Type: boolean
  • Required: No
  • Default: true

<createManyToOneForForeignKey>

If true, a many-to-one association will be created for each foreignkey found.
  • Type: boolean
  • Required: No
  • Default: true

<delimiter>

Set the end of statement delimiter.
  • Type: java.lang.String
  • Required: No
  • Default: ;

<detectManyToMany>

If true, tables which are pure many-to-many link tables will be mapped as such. A pure many-to-many table is one which primary-key contains exactly two foreign-keys pointing to other entity tables and has no other columns.
  • Type: boolean
  • Required: No
  • Default: true

<detectOneToOne>

If true, a one-to-one association will be created for each foreignkey found.
  • Type: boolean
  • Required: No
  • Default: true

<detectOptimisticLock>

If true, columns named VERSION or TIMESTAMP with appropriate types will be mapped with the appropriate optimistic locking corresponding to <version> or <timestamp>.
  • Type: boolean
  • Required: No
  • Default: true

<format>

Should we format the sql strings?
  • Type: boolean
  • Required: No
  • Default: true

<haltOnError>

Should we stop once an error occurs?
  • Type: boolean
  • Required: No
  • Default: true

<outputDirectory>

The directory into which the DDLs will be generated.
  • Type: java.io.File
  • Required: No
  • Default: ${project.build.directory}/generated-resources/

<outputFileName>

The default filename of the generated DDL script.
  • Type: java.lang.String
  • Required: No
  • Default: schema.ddl

<packageName>

The default package name to use when mappings for classes are created.
  • Type: java.lang.String
  • Required: No

<propertyFile>

The name of a property file, e.g. hibernate.properties.
  • Type: java.io.File
  • Required: No
  • Default: ${project.basedir}/src/main/hibernate/hibernate.properties

<revengFile>

The name of a property file, e.g. hibernate.properties.
  • Type: java.io.File
  • Required: No

<revengStrategy>

The class name of the reverse engineering strategy to use. Extend the DefaultReverseEngineeringStrategy and override the corresponding methods, e.g. to adapt the generate class names or to provide custom type mappings.
  • Type: java.lang.String
  • Required: No
  • Default: org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy

<schemaExportAction>

The DDLs statements to create.
  • NONE: None - duh :P.
  • CREATE (default): Create only.
  • DROP: Drop only.
  • BOTH: Drop and then create.
  • Type: org.hibernate.tool.hbm2ddl.SchemaExport$Action
  • Required: No
  • Default: CREATE

<targetTypes>

The type of output to produce.
  • DATABASE: Export to the database.
  • SCRIPT (default): Write to a script file.
  • STDOUT: Write to System.out.
  • Type: java.util.Set
  • Required: No
  • Default: SCRIPT