Skip to content
This repository has been archived by the owner on Nov 21, 2022. It is now read-only.

Latest commit

 

History

History
52 lines (46 loc) · 1.63 KB

README.md

File metadata and controls

52 lines (46 loc) · 1.63 KB

Build Status Download

hibernate-schema-gradle-plugin

Gradle plugin for generate DDL scripts from JPA entities using Hibernate SchemaExport tool.

Supports only generation from annotated entities without persistence.xml or hibernate.cfg.xml.

Built and tested with Hibernate 5.2.2.Final.

How-to Use

buildscript {
  repositories {
    jcenter()
  }
  dependencies {
    classpath("com.github.deathman92.plugin:hibernate-schema-gradle-plugin:1.0.0")
  }
}

apply plugin: 'java'
apply plugin: 'hibernate-schema-generate' // or 'com.github.deathman92.plugin.hibernate-schema-generate'

generateSchema {
  // properties (see Setting later)
}

To generate schema, run

gradle generateSchema

or

./gradlew generateSchema

Settings

generateSchema {
  outputDir = file('src/main/resources/db/schema') // folder where output file will be written
  outputFileName = 'schema.ddl' // name of output file
  packageNames = ['com.example.domain'] // required
  dialect = 'org.hibernate.dialect.PostgreSQLDialect' // required
  implicitStrategy = 'org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl'
  physicalStrategy = 'org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl'
  properties = [
    'key' : 'value'
  ]
}

License

MIT