Previous Topic: EclipseLink Properties for a SessionNext Topic: APPC Agent


EclipseLink Properties for Schema

You can define the EclipseLink JPA persistence unit properties in a persistence.xml file to configure schema generation.

eclipselink.ddl-generation

Specifies the Data Definition Language (DDL) generation action to use for your JPA entities. To specify the DDL generation target, see eclipselink.ddl-generation.output-mode.

Values:

You can use the following values in a persistence.xml file:

The following values are valid for the org.eclipse.persistence.config.PersistenceUnitProperties:

If you use persistence in a Java SE environment and you want to create the DDL files without creating tables, define a Java system property INTERACT_WITH_DB and set the value to false.

Default: One of the following:

Example:

persistence.xml file<property value="create-tables"/>Example: property Mapimport org.eclipse.persistence.config.PersistenceUnitProperties;propertiesMap.put(PersistenceUnitProperties.DDL_GENERATION, PersistenceUnitProperties.CREATE_ONLY);

eclipselink.application-location

Specifies where EclipseLink writes generated DDL files. Files are written if you set eclipselink.ddl-generation to anything other than none.

Value: A file specification to a directory in which you have write access. The file specification can be relative to your current working directory or absolute. If it does not end in a file separator, EclipseLink appends one that is valid for your operating system.

Default: One of the following:

"."+File.separator

or

<tt>PersistenceUnitProperties.DEFAULT_APP_LOCATION</tt>

Example:

persistence.xml file<property value="C:\ddl\"/>Example: property Mapimport org.eclipse.persistence.config.PersistenceUnitProperties;propertiesMap.put(PersistenceUnitProperties.APP_LOCATION, "C:\ddl\");

eclipselink.create-ddl-jdbc-file-name

Specifies the file name of the DDL file that EclipseLink generates containing SQL statements to create tables for JPA entities. This file is written to the location specified by eclipselink.application-location when eclipselink.ddl-generation is set to create-tables or drop-and-create-tables.

Values: A file name valid for your operating system. Optionally, if the concatenation of eclipselink.application-location with eclipselink.create-ddl-jdbc-file-name is a valid file specification for your operating system, you can prefix the file name with a file path.

Default: One of the following:

or

Example:

persistence.xml file<property value="create.sql"/> Example: property Mapimport org.eclipse.persistence.config.PersistenceUnitProperties;propertiesMap.put(PersistenceUnitProperties.CREATE_JDBC_DDL_FILE, "create.sql");

eclipselink.drop-ddl-jdbc-file-name

Specifies the file name of the DDL file that EclipseLink generates containing the SQL statements to drop tables for JPA entities. This file is written to the location specified by eclipselink.application-location when eclipselink.ddl-generation is set to drop-and-create-tables.

Values: A file name valid for your operating system. Optionally, if the concatenation of eclipselink.application-location with eclipselink.drop-ddl-jdbc-file-name is a valid file specification for your operating system, you can prefix the file name with a file path.

Default: One of the following:

or

Example:

persistence.xml file<property value="drop.sql"/>Example: property Mapimport org.eclipse.persistence.config.PersistenceUnitProperties;propertiesMap.put(PersistenceUnitProperties.DROP_JDBC_DDL_FILE, "drop.sql");

eclipselink.ddl-generation.output-mode

Defines the DDL generation target.

Values:

The valid values for the use in the persistence.xml file are:

both:
database:
sql-script:

Default: The default for Container or Java EE mode is {{database}},

Example:

persistence.xml file<property value="database"/>Example: property Mapimport org.eclipse.persistence.config.PersistenceUnitProperties;propertiesMap.put(PersistenceUnitProperties.DDL_GENERATION_MODE, PersistenceUnitProperties.DDL_DATABASE_GENERATION);

Note: Override this setting by containers with specific EclipseLink support. See your container documentation for details. Bootstrap or Java SE mode: both or PersistenceUnitProperties.DDL_BOTH_GENERATION.