hibernate-schema-plugin

Maven plugin for exporting Hibernate schema

License

License

Categories

Categories

Hibernate Data ORM
GroupId

GroupId

com.vecna
ArtifactId

ArtifactId

hibernate-schema-plugin
Last Version

Last Version

2.8
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

hibernate-schema-plugin
Maven plugin for exporting Hibernate schema
Project Organization

Project Organization

Vecna Technologies
Source Code Management

Source Code Management

https://github.com/vecnatechnologies/hibernate-schema-plugin

Download hibernate-schema-plugin

How to add to project

<plugin>
    <groupId>com.vecna</groupId>
    <artifactId>hibernate-schema-plugin</artifactId>
    <version>2.8</version>
</plugin>

Dependencies

compile (6)

Group / Artifact Type Version
com.vecna : maven-commons jar 0.0.2
org.hibernate : hibernate-core jar 4.2.6.Final
org.slf4j : slf4j-api jar 1.5.8
com.vecna : dbDiff-hibernate jar 2.2
org.hibernate : hibernate-tools jar 4.0.0-CR1
com.thoughtworks.qdox : qdox jar 1.12

provided (1)

Group / Artifact Type Version
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.2

Project Modules

There are no modules declared in this project.

Maven Hibernate Plugin

About

This plugin exports/validates Hibernate schema as part of a Maven build process.

Features

  • Hibernate 4 support
  • Envers support/detection
  • Support for multiple cfg.xml
  • Mapped classes and hbm.xml can be specified in the cfg.xml and/or as plugin properties
  • Hibernate properties can be supplied by one or more .properties files and/or as plugin properties
  • Full schema validation including column types, foreign keys, and indices.

Usage

Specifying the Hibernate configuration is fairly straightforward (see below).

<plugin>
  <groupId>com.vecna</groupId>
  <artifactId>hibernate-schema-plugin</artifactId>
  <configuration>
    <configFiles>
      <configFile>module1.cfg.xml</configFile>
      <configFile>module2.cfg.xml</configFile>
    </configFiles>
    <additionalMappings>
      <additionalMapping>MyClass.hbm.xml</additionalMapping>
    </additionalMappings>
    <additionalClasses>
      <additionalMapping>org.package.MyAnnotatedClass</additionalMapping>
    </additionalClasses>
    <properties>
      <hibernate.connection.url>jdbc:postgresql://localhost/mydb</hibernate.connection.url>
    </properties>
  </configuration>
  <dependencies>
    <dependency>
      <groupId>postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>8.4</version>
    </dependency>
  </dependencies>
</plugin>

Key points are:

  • Specify connection parameters (inline in the POM or via one or more .properties files) and dialect
  • Add the JDBC driver as a plugin dependency (if it's not a project dependency)

Since version 2, this plugin works with Hibernate 4. For Hibernate 3 support, use versions 1.x.

Goals

  • export: export the Hibernate schema into a file and/or a live database
  • validate: validate the Hibernate configuration against a live database
  • update: generate update scripts (this goal is very basic - it runs Hibernate's SchemaExport and only handles new columns)
  • doc: generate schema documentation from javadocs

Credits

Originally developed by Vecna Technologies, Inc. and open sourced as part of its community service program. See the LICENSE file for more details. Vecna Technologies encourages employees to give 10% of their paid working time to community service projects. To learn more about Vecna Technologies, its products and community service programs, please visit http://www.vecna.com.

com.vecna

Vecna Technologies, Inc.

Versions

Version
2.8
2.7
2.6
2.5
2.4
2.3
2.2
2.1
2.0
2.0-RC1
1.3
1.2
1.1
1.0