Oracle GlassFish Server 3.0.1 Application Development Guide

Generation Options

Schema generation properties or asadmin command line options can control automatic schema generation by the following:


Note –

Before using these options, make sure you have a properly configured database. See Specifying the Database.


Optional schema generation properties control the automatic creation of database tables. You can specify them in the persistence.xml file. For more information, see Using EclipseLink JPA Extensions for Schema Generation.

The following options of the asadmin deploy or asadmin deploydir command control the automatic creation of database tables at deployment.

Table 7–1 The asadmin deploy and asadmin deploydir Generation Options

Option 

Default 

Description 

----createtables

none 

If true, causes database tables to be created for entities that need them. If false, does not create tables. If not specified, the value of the eclipselink.ddl-generation property in persistence.xml is used.

----dropandcreatetables

none 

If true, and if tables were automatically created when this application was last deployed, tables from the earlier deployment are dropped and fresh ones are created.

If true, and if tables were not automatically created when this application was last deployed, no attempt is made to drop any tables. If tables with the same names as those that would have been automatically created are found, the deployment proceeds, but a warning is thrown to indicate that tables could not be created.

If false, the eclipselink.ddl-generation property setting in persistence.xml is overridden.

The following options of the asadmin undeploy command control the automatic removal of database tables at undeployment.

Table 7–2 The asadmin undeploy Generation Options

Option 

Default 

Description 

----droptables

none 

If true, causes database tables that were automatically created when the entities were last deployed to be dropped when the entities are undeployed. If false, does not drop tables.

If not specified, tables are dropped only if the eclipselink.ddl-generation property setting in persistence.xml is drop-and-create-tables.

For more information about the asadmin deploy, asadmin deploydir, and asadmin undeploy commands, see the Oracle GlassFish Server 3.0.1 Reference Manual.

When asadmin deployment options and persistence.xml options are both specified, the asadmin deployment options take precedence.

The Ant tasks sun-appserv-deploy and sun-appserv-undeploy are equivalent to asadmin deploy and asadmin undeploy, respectively. These Ant tasks also override the persistence.xml options. For details, see Chapter 3, Using Ant with GlassFishTM Server.