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

Gradle plugin for generate DDL scripts from JPA entities

License

Notifications You must be signed in to change notification settings

deathman92/hibernate-schema-gradle-plugin

Repository files navigation

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

About

Gradle plugin for generate DDL scripts from JPA entities

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published