Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Import and export to DB

NotificationsYou must be signed in to change notification settings

carchrae/play--database

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This module allows you to export yourJPA classes to anSQL script or to import a database tables toPOJO instances.

Enable the DB module for the application

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

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

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

# Default Schemadb.default.schema=MY_SCHEMA

Creating anSQL script from your domain model

play db:export myapplication

This command will create theSQL 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 yourJPA dialect in your/conf/application.conf file.

Options (only with play! version greater than 1.0.2.1)

Generate only theSQL drop clauses

play db:export myapplication --drop

Generate only theSQL create clauses

play db:export myapplication --create

Specify theSQL 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 theSQL.

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)

EnablesCRUD Controller generation (with the secure-module annotation).

play db:import myapplication --crud

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

play db:import myapplication --no-pojo

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

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

About

Import and export to DB

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2026 Movatter.jp