Play! DB Module


License

License

unknown
Categories

Categories

Maven Build Tools
GroupId

GroupId

com.google.code.maven-play-plugin.org.playframework.modules.db
ArtifactId

ArtifactId

play-db
Last Version

Last Version

1.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

Play! DB Module
Play! DB Module
Source Code Management

Source Code Management

https://github.com/pepite/play--database

Download play-db

How to add to project

<!-- https://jarcasting.com/artifacts/com.google.code.maven-play-plugin.org.playframework.modules.db/play-db/ -->
<dependency>
    <groupId>com.google.code.maven-play-plugin.org.playframework.modules.db</groupId>
    <artifactId>play-db</artifactId>
    <version>1.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.google.code.maven-play-plugin.org.playframework.modules.db/play-db/
implementation 'com.google.code.maven-play-plugin.org.playframework.modules.db:play-db:1.1.1'
// https://jarcasting.com/artifacts/com.google.code.maven-play-plugin.org.playframework.modules.db/play-db/
implementation ("com.google.code.maven-play-plugin.org.playframework.modules.db:play-db:1.1.1")
'com.google.code.maven-play-plugin.org.playframework.modules.db:play-db:jar:1.1.1'
<dependency org="com.google.code.maven-play-plugin.org.playframework.modules.db" name="play-db" rev="1.1.1">
  <artifact name="play-db" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.google.code.maven-play-plugin.org.playframework.modules.db', module='play-db', version='1.1.1')
)
libraryDependencies += "com.google.code.maven-play-plugin.org.playframework.modules.db" % "play-db" % "1.1.1"
[com.google.code.maven-play-plugin.org.playframework.modules.db/play-db "1.1.1"]

Dependencies

compile (2)

Group / Artifact Type Version
org.hibernate : hibernate-tools jar 3.2.0.beta8
freemarker : freemarker jar 2.3.8

provided (1)

Group / Artifact Type Version
com.google.code.maven-play-plugin.org.playframework : play jar 1.1

Project Modules

There are no modules declared in this project.

DB module

This module allows you to export your JPA classes to an SQL script or to import a database tables to POJO instances.

Enable the DB module for the application

In the /conf/application.conf file, enable the DB module by adding this line:

# The db  module
module.db=${play.path}/modules/db

You can also define a default schema (as in hibernate.default_schema) with :

# Default Schema
db.default.schema=MY_SCHEMA

Creating an SQL script from your domain model

play db:export myapplication

This command will create the SQL necessary to create your database. This is extremely usefull if you want to deploy your application in production and you are require to update the database manually.
Be sure to configure correctly your JPA dialect in your /conf/application.conf file.

Options (only with play! version greater than 1.0.2.1)

Generate only the SQL drop clauses

play db:export myapplication --drop

Generate only the SQL create clauses

play db:export myapplication --create

Specify the SQL delimiter

play db:export myapplication --delimiter=;

Specify the output file

play db:export myapplication  --output=myfile.ddl

Export to the database

play db:export myapplication  --export

Import extra data to the database (to be use with —export)

play db:export myapplication  --import=import.sql

Do not format the SQL.

play db:export myapplication  --noformat

Halt the export / script generation on the first error

play db:export myapplication  --haltonerror

Creating your domain model from the database

play db:import myapplication

This command will create the classes in the models package based on the database tables. This is useful is you have an existing database and you want to re-use this database.

Be sure to configure correctly your database access using your /conf/application.conf file (db.user, db.pass, db.driver, db.url, etc…).

Options (only with play! version greater than 1.0.2.1)

Enables CRUD Controller generation (with the secure-module annotation).

play db:import myapplication --crud

Disables POJO generation. Useful if you want to keep the already generated files.

play db:import myapplication --no-pojo

Enables reverse engineering customization.
See Hibernate Tools documentation
WARNING: the <table> elements in the reverse engineering file seems to be ignored for POJO and CRUD generation.
<schema-selection>, <type-mapping> and <table-filter> work correctly, though.

play db:import myapplication --reveng=path.to/hibernate.reveng.xml

Versions

Version
1.1.1