Fork me on GitHub

hibernate-tools:hbm2java

Full name:

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

Description:

Mojo to generate Java JPA Entities from an existing database.

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

Attributes:

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

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.
<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.
<ejb3> boolean - Code will contain EJB 3 features, e.g. using annotations from javax.persistence and org.hibernate.annotations.
Default value is: false.
<jdk5> boolean - Code will contain JDK 5 constructs such as generics and static imports.
Default value is: false.
<outputDirectory> File - The directory into which the JPA entities will be generated.
Default value is: ${project.build.directory}/generated-sources/.
<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.
<templatePath> String - A path used for looking up user-edited templates.

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

<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

<ejb3>

Code will contain EJB 3 features, e.g. using annotations from javax.persistence and org.hibernate.annotations.
  • Type: boolean
  • Required: No
  • Default: false

<jdk5>

Code will contain JDK 5 constructs such as generics and static imports.
  • Type: boolean
  • Required: No
  • Default: false

<outputDirectory>

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

<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

<templatePath>

A path used for looking up user-edited templates.
  • Type: java.lang.String
  • Required: No