Skip Headers
Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide
10g (10.1.3.5.0)

Part Number E13981-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

Configuring the persistence.xml File

This section describes the following:

For more information, see "What is the persistence.xml File?".

Configuring the persistence.xml With a Named Persistence Unit File

Example 26-1 shows an example persistence.xml file that contains one persistence unit.

Example 26-1 Named Persistence Unit

<persistence-unit name="OrderManagement5">
    <provider>com.acme.persistence</provider>
    <transaction-type>RESOURCE_LOCAL</transaction-type>
    <mapping-file>order1.xml</mapping-file>
    <jar-file>order.jar</jar-file>
    <class>com.acme.Order</class>
    <properties>
        <property name="com.acme.persistence.sql-logging" value="on"/>
    </properties>
</persistence-unit>

This persistence unit is named OrderManagement5 and uses EntityManager provider com.acme.persistence. Its <transaction-type> specifies that this persistence unit requires only a non-JTA data source. It defines its set of persistent managed classes using all of <mapping-file>, <jar-file>, and <class> elements (see "What Persistent Managed Classes Does This Persistence Unit Include?"). It sets property com.acme.persistence.sql.logging to a value of on using a <property> element.

For detailed descriptions of <persistence-unit> element attributes and subelements, see the EJB 3.0 specification.

What Persistent Managed Classes Does This Persistence Unit Include?

You can specify the persistent managed classes associated with a persistence unit by using one or more of the following:

  • <mapping-file> element: specifies one or more object-relational mapping XML files (orm.xml files).

  • <jar-file> element: specifies one or more JAR files that will be searched for classes.

  • <class> element: specifies an explicit list of classes.

  • The annotated managed persistence classes contained in the root of the persistence unit.

    The root of the persistence unit is the JAR file or directory, whose META-INF directory contains the persistence.xml file. To exclude managed persistence classes, add an <exclude-unlisted-classes> element to the persistence unit.

Configuring the persistence.xml File for the OC4J Default Persistence Unit

Using the OC4J default persistence unit, you can acquire an entity manager without having to specify a persistence unit by name (see "Understanding OC4J Persistence Unit Defaults").

By default, to use the OC4J default persistence unit, you do not need to deploy a persistence.xml file at all.

If you set orion-ejb-jar.xml file attribute disable-default-persistent-unit to true, OC4J will expect a persistence.xml file. In this case, you can still use the OC4J default persistence unit if you specify an empty persistence unit: configure your persistence.xml file with an empty persistence unit using any of the following:

  • Empty <persistence> element:

    <persistence>
    </persistence>
    
  • Self-closing <persistence/> element

  • Completely empty (zero length) persistence.xml file

You may specify one persistence unit for each scope or module: for example, one for each EJB JAR.

Specifying a Data Source in a Persistence Unit

In a Java EE application, you specify your data source in a <jta-data-source> element as Example 26-2 shows. For more information, see "Configuring Data Sources".

In a Java SE application, you specify your data source using JDBC vendor extensions, as Example 26-3 shows. For more information, see "TopLink JPA Extensions for JDBC (Java SE)").

Alternatively, using OC4J, you can use the default data source (see "What is a Default Data Source?").

Configuring Vendor Extensions in a Persistence Unit

This section describes the TopLink JPA vendor extensions that you can define in a persistence unit, including the following:

You can specify these vendor extensions by using a <properties> element in your persistence.xml file. Example 26-2 shows how to set a TopLink JPA persistence unit extension in a persistence.xml file for a Java EE application, and Example 26-3 shows how to do the same for a Java SE application.

Example 26-2 Configuring a Vendor Extension in the Persistence.xml File (Java EE)

<persistence-unit name="default" transaction-type="JTA">
    <provider>
        oracle.toplink.essentials.PersistenceProvider
    </provider>
    <jta-data-source>
        jdbc/MyDataSource
    </jta-data-source>
    <properties>
        <property name="toplink.logging.level" value="INFO"/>
    </properties>
</persistence-unit>

Example 26-3 Configuring a Vendor Extension in the Persistence.xml File (Java SE)

<persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
    <provider>
        oracle.toplink.essentials.PersistenceProvider
    </provider>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
        <property name="toplink.logging.level" value="INFO"/>
        <property name="toplink.jdbc.driver" value="oracle.jdbc.OracleDriver"/>
        <property name="toplink.jdbc.url" value="jdbc:oracle:thin:@myhost:l521:MYSID"/>
        <property name="toplink.jdbc.password" value="tiger"/>
        <property name="toplink.jdbc.user" value="scott"/>
    </properties>
</persistence-unit>

Alternatively, you can set a TopLink JPA persistence unit extension in the Map of properties you pass into a call to javax.persistence.Persistence method createEntityManagerFactory as Example 26-4 shows. You can override extensions set in the persistence.xml file in this way. When you set an extension in a Map of properties, you can set the value using the public static final field in the appropriate configuration class in oracle.toplink.essentials.config, including the following:

  • CacheType

  • TargetDatabase

  • TargetServer

  • TopLinkProperties

Note:

To access these classes, ensure that the appropriate OC4J persistence JAR is in your classpath. For more information, see "TopLink Essentials JPA Persistence Provider".

Example 26-4 shows how to set the value of extension toplink.cache.type.default using the CacheType configuration class.

Example 26-4 Configuring a Vendor Extension When Creating an EntityManagerFactory

import oracle.toplink.essentials.config.CacheType;

Map properties = new HashMap();
properties.put(TopLinkProperties.CACHE_TYPE_DEFAULT, CacheType.Full);
EntityManagerFactory emf = Persistence.createEntityManagerFactory("default", properties);

TopLink JPA Extensions for JDBC (Java SE)

Table 26-1 lists the TopLink JPA extensions that you can define in a persistence.xml file to configure JDBC driver parameters. These extensions apply only when used outside of a EJB container.

Table 26-1 TopLink JPA Extensions for JDBC (Java SE)

Property Usage Default

toplink.jdbc.bind-parameters

Control whether or not the query uses parameter binding.

For more information, see "Using Conforming Queries and Descriptors" in the Oracle TopLink Developer's Guide.

Valid values:

  • true–bind all parameters.

  • false–do not bind parameters.

Example: persistence.xml file

<property name="toplink.jdbc.bind-parameters" value="true"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(ToplinkProperties.JDBC_BIND_PARAMETERS, "true");

true

toplink.jdbc.driver

The class name of the JDBC driver you want to use, fully qualified by its package name. This class must be on your application classpath.

Example: persistence.xml file

<property name="toplink.jdbc.driver" value="oracle.jdbc.driver.OracleDriver"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(ToplinkProperties.JDBC_DRIVER, "oracle.jdbc.driver.OracleDriver");
 

toplink.jdbc.password

The password for your JDBC user.

Example: persistence.xml file

<property name="toplink.jdbc.password" value="tiger"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(ToplinkProperties.JDBC_PASSWORD, "tiger");
 

toplink.jdbc.read-connections.max

The maximum number of connections allowed in the JDBC read connection pool.

Valid values: 0 to Integer.MAX_VALUE (depending on your JDBC driver) as a String.

Example: persistence.xml file

<property name="toplink.jdbc.read-connections.max" value="3"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(ToplinkProperties.JDBC_READ_CONNECTIONS_MAX, "3");

2

toplink.jdbc.read-connections.min

The minimum number of connections allowed in the JDBC read connection pool.

Valid values: 0 to Integer.MAX_VALUE (depending on your JDBC driver) as a String.

Example: persistence.xml file

<property name="toplink.jdbc.read-connections.min" value="1"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(ToplinkProperties.JDBC_READ_CONNECTIONS_MIN, "1");

2

toplink.jdbc.read-connections.shared

Specify whether or not to allow concurrent use of shared read connections.

Valid values:

  • true–allow concurrent use of shared read connections.

  • false–do not allow the concurrent use of shared read connections; concurrent readers are each allocated their own read connection.

Example: persistence.xml file

<property name="toplink.jdbc.read-connections.shared" value="true"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(ToplinkProperties.JDBC_READ_CONNECTIONS_SHARED, "true");

false

toplink.jdbc.url

The JDBC connection URL required by your JDBC driver.

Example: persistence.xml file

<property name="toplink.jdbc.url" value="jdbc:oracle:thin:@MYHOST:1521:MYSID"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(ToplinkProperties.JDBC_URL, "jdbc:oracle:thin:@MYHOST:1521:MYSID");
 

toplink.jdbc.user

The user name for your JDBC user.

Example: persistence.xml file

<property name="toplink.jdbc.user" value="scott"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(ToplinkProperties.JDBC_USER, "scott");
 

toplink.jdbc.write-connections.max

The maximum number of connections allowed in the JDBC write connection pool.

Valid values: 0 to Integer.MAX_VALUE (depending on your JDBC driver) as a String.

Example: persistence.xml file

<property name="toplink.jdbc.write-connections.max" value="5"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(ToplinkProperties.JDBC_WRITE_CONNECTIONS_MAX, "5");

10

toplink.jdbc.write-connections.min

The minimum number of connections allowed in the JDBC write connection pool.

Valid values: 0 to Integer.MAX_VALUE (depending on your JDBC driver) as a String.

Example: persistence.xml file

<property name="toplink.jdbc.write-connections.min" value="2"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(ToplinkProperties.JDBC_WRITE_CONNECTIONS_MIN, "2");

5


TopLink JPA Extensions for Caching

Table 26-2 lists the TopLink JPA extensions that you can define in a persistence.xml file to configure the TopLink cache.

For more information, see "Understanding the Cache" in the Oracle TopLink Developer's Guide.

Table 26-2 TopLink JPA Extensions for Caching

Property Usage Default

toplink.cache.type.default

The default type of session cache.

A session cache is a shared cache that services clients attached to a given session. When you read objects from or write objects to the data source using a client session, TopLink saves a copy of the objects in the parent server session's cache and makes them accessible to child client sessions.

Valid values: oracle.toplink.essentials.config.CacheType

  • Full–This option provides full caching and guaranteed identity: objects are never flushed from memory unless they are deleted.

    For more information, see "Full Identity Map" in the Oracle TopLink Developer's Guide.

  • HardWeak–This option is similar to Weak, except that it maintains a most frequently used subcache that uses hard references.

    For more information, see "Soft and Hard Cache Weak Identity Maps" in the Oracle TopLink Developer's Guide.

  • NONE–This option does not preserve object identity and does not cache objects. Oracle does not recommend using this option.

    For more information, see "No Identity Map" in the Oracle TopLink Developer's Guide.

  • SoftWeak–This option is similar to Weak, except that it maintains a most frequently used subcache that uses soft references. Oracle recommends using this identity map in most circumstances as a means to control memory used by the cache.

    For more information, see "Soft and Hard Cache Weak Identity Maps" in the Oracle TopLink Developer's Guide.

  • Weak–This option is similar to Full, except that objects are referenced using weak references. This option uses less memory than Full, but does not provide a durable caching strategy across client/server transactions. Oracle recommends using this identity map for transactions that, once started, stay on the server side.

    For more information, see "Weak Identity Map" in the Oracle TopLink Developer's Guide.

Example: persistence.xml file

<property name="toplink.cache.type.default" value="Full"/>

Example: property Map

import oracle.toplink.essentials.config.CacheType;
import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(ToplinkProperties.CACHE_TYPE_DEFAULT, CacheType.Full);

SoftWeak

toplink.cache.size.default

The default maximum number of objects allowed in a TopLink cache.

Valid values: 0 to Integer.MAX_VALUE as a String.

Example:

<property name="toplink.cache.size.default" value="5000"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(ToplinkProperties.CACHE_SIZE_DEFAULT, 1000);

1000

toplink.cache.shared.default

The default for whether or not the TopLink session cache is shared by multiple client sessions.

Valid values:

  • true–The session cache services all clients attached to the session. When you read objects from or write objects to the data source using a client session, TopLink saves a copy of the objects in the parent server session's cache and makes them accessible to all other processes in the session.

  • false–The session cache services a single, isolated client exclusively. The isolated client can reference objects in a shared session cache but no client can reference objects in the isolated client's exclusive cache.

Example:

<property name="toplink.cache.shared.default" value="true"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(ToplinkProperties.CACHE_SHARED_DEFAULT, "true");

true

toplink.cache.type.<ENTITY>

The type of session cache for the JPA entity named <ENTITY>.

For more information on entity names, see @Entity.

Valid values: oracle.toplink.essentials.config.CacheType

Example: persistence.xml file

<property name="toplink.cache.type.Order" value="Full"/>

Example: property Map

import oracle.toplink.essentials.config.CacheType
import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(TopLinkProperties.CACHE_TYPE+".Order", CacheType.Full);

SoftWeak

toplink.cache.size.<ENTITY>

The maximum number of JPA entities of the type denoted by JPA entity name <ENTITY> allowed in a TopLink cache.

For more information on entity names, see @Entity.

Valid values: 0 to Integer.MAX_VALUE as a String.

Example:

<property name="toplink.cache.size.Order" value="5000"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(ToplinkProperties.CACHE_SIZE+".Order", 1000);

1000

toplink.cache.shared.<ENTITY>

Whether or not the TopLink session cache is shared by multiple client sessions for JPA entities of the type denoted by JPA entity name <ENTITY>.

For more information on entity names, see @Entity.

Valid values:

  • true–The session cache services all clients attached to the session. When you read objects from or write objects to the data source using a client session, TopLink saves a copy of the objects in the parent server session's cache and makes them accessible to all other processes in the session.

  • false–The session cache services a single, isolated client exclusively. The isolated client can reference objects in a shared session cache but no client can reference objects in the isolated client's exclusive cache.

Example:

<property name="toplink.cache.shared.Order" value="true"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(ToplinkProperties.CACHE_SHARED+".Order", "true");

true


TopLink JPA Extensions for Logging

Table 26-3 lists the TopLink JPA extensions that you can define in a persistence.xml file to configure TopLink logging.

For more information, see "Configuring Logging" in the Oracle TopLink Developer's Guide.

Table 26-3 TopLink JPA Extensions for Logging

Property Usage Default

toplink.logging.level

Control the amount and detail of log output by configuring the log level (in ascending order of information):

Valid values: java.util.logging.Level

  • OFF–disable logging

  • Level.SEVERE–Logs exceptions indicating TopLink cannot continue, as well as any exceptions generated during login. This includes a stack trace.

  • WARNING–Logs exceptions that do not force TopLink to stop, including all exceptions not logged with severe level. This does not include a stack trace.

  • INFO–Logs the login/logout for each server session, including the user name. After acquiring the session, detailed information is logged.

  • CONFIG–Logs only login, JDBC connection, and database information.

  • FINE–Logs SQL.

  • FINER–Similar to warning. Includes stack trace.

  • FINEST–Includes additional low level information.

Example: persistence.xml file

<property name="toplink.logging.level" value="WARNING"/>

Example: property Map

import java.util.logging.Level;
import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(TopLinkProperties.LOGGING_LEVEL, Level.INFO);

CONFIG

toplink.logging.timestamp

Control whether the timestamp is logged in each log entry.

Valid values:

  • true–log a timestamp.

  • false–do not log a timestamp.

Example: persistence.xml file

<property name="toplink.logging.timestamp" value="true"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(TopLinkProperties.LOGGING_TIMESTAMP, "true");

true

toplink.logging.thread

Control whether a thread identifier is logged in each log entry.

Valid values:

  • true–log a thread identifier.

  • false–do not log a thread identifier.

Example: persistence.xml file

<property name="toplink.logging.thread" value="true"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(TopLinkProperties.LOGGING_THREAD, "true");

true

toplink.logging.session

Control whether a TopLink session identifier is logged in each log entry.

Valid values:

  • true–log a TopLink session identifier.

  • false–do not log a TopLink session identifier.

Example: persistence.xml file

<property name="toplink.logging.session" value="true"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(TopLinkProperties.LOGGING_SESSION, "true");

true

toplink.logging.exceptions

Control whether the exceptions thrown from within the TopLink code are logged prior to returning the exception to the calling application. Ensures that all exceptions are logged and not masked by the application code.

Valid values:

  • true–log all exceptions.

  • false–do not log exceptions.

Example: persistence.xml file

<property name="toplink.logging.exceptions" value="true"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(TopLinkProperties.LOGGING_EXCEPTIONS, "true");

false


TopLink JPA Extensions for Database, Session, and Application Server

Table 26-4 lists the TopLink JPA extensions that you can define in a persistence.xml file to configure TopLink extensions for database, session, and application server.

Table 26-4 TopLink JPA Extensions for Database, Session, and Application Server

Property Usage Default

toplink.target-database

Specify the type of database that your JPA application uses. The TargetDatabase enum contains an entry for many of the more common database types supported.

Valid values: oracle.toplink.essentials.config.TargetDatabase

  • Attunity–configure the persistence provider to use an Attunity database.

  • Auto–TopLink accesses the database and uses the metadata that JDBC provides to determine the target database. Applicable to JDBC drives that support this metadata.

  • Cloudscape–configure the persistence provider to use a Cloudscape database.

  • Database–configure the persistence provider to use a generic choice if your target database is not listed here and your JDBC driver does not support the use of metadata that the Auto option requires.

  • DB2–configure the persistence provider to use a DB2 database.

  • DB2Mainframe–configure the persistence provider to use a DB2Mainframe database.

  • DBase–configure the persistence provider to use a DBase database.

  • Derby–configure the persistence provider to use a Derby database.

  • HSQL–configure the persistence provider to use an HSQL database.

  • Informix–configure the persistence provider to use an Informix database.

  • JavaDB–configure the persistence provider to use a JavaDB database.

  • MySQL4–configure the persistence provider to use a MySQL4 database.

  • Oracle–configure the persistence provider to use an Oracle database.

  • PointBase–configure the persistence provider to use a PointBase database.

  • PostgreSQL–configure the persistence provider to use a PostgreSQL database.

  • SQLAnyWhere–configure the persistence provider to use an SQLAnyWhere database.

  • SQLServer–configure the persistence provider to use an SQLServer database.

  • Sybase–configure the persistence provider to use a Sybase database.

  • TimesTen–configure the persistence provider to use a TimesTen database.

Example: persistence.xml file

<property name="toplink.target-database" value="Oracle"/>

Example: property Map

import oracle.toplink.essentials.config.TargetDatabase;
import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(TopLinkProperties.TARGET_DATABASE, TargetDatabase.Oracle);

Auto

toplink.session-name

Specify the name by which the TopLink session is stored in the static session manager. Use this option if you need to access the TopLink shared session outside of the context of the Java Persistence API.

Valid values: a valid TopLink session name that is unique in a server deployment.

Example: persistence.xml file

<property name="toplink.session-name" value="MySession"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(TopLinkProperties.SESSION_NAME, "MySession");

TopLink generated unique name.

toplink.target-server

Specify the type of application server that your JPA application uses:

Valid values: oracle.toplink.essentials.config.TargetServer

  • None–configure the persistence provider to use no application server.

  • OC4J_10_1_3–configure the persistence provider to use OC4J 10.1.3.0.

  • SunAS9–configure the persistence provider to use Sun Application Server version 9.

Example: persistence.xml file

<property name="toplink.target-server" value="OC4J_10_1_3"/>

Example: property Map

import oracle.toplink.essentials.config.TargetServer;
import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(TopLinkProperties.TARGET_SERVER, TargetServer.OC4J_10_1_3);

None


TopLink JPA Extensions for Customization

Table 26-5 lists the TopLink JPA extensions that you can define in a persistence.xml file to configure TopLink customization and validation.

Table 26-5 TopLink JPA Extensions for Customization and Validation

Property Usage Default

toplink.weaving

Control whether or not the weaving of the entity classes is performed. Weaving is required in order to use lazy fetching of @OneToOne and @ManyToOne relationships.

Valid values:

  • true–weave entity classes.

  • false–do not weave entity classes.

  • static–weave entity classes statically.

    Use this option if you plan to execute your application outside of a Java EE 5 container in an environment that does not permit the use of -javagent:toplink-essentials-agent.jar on the JVM command line.

Example: persistence.xml file

<property name="toplink.weaving" value="true"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(TopLinkProperties.WEAVING, "true");

true

toplink.session.customizer

Specify a TopLink session customizer class: a Java class that implements the oracle.toplink.essentials.tools.sessionconfiguration.SessionCustomizer interface and provides a default (zero-argument) constructor. Use this class's customize method, which takes an oracle.toplink.essentials.sessions.Session, to programmatically access advanced TopLink session API.

For more information, see "Session Customization".

Valid values: class name of a SessionCustomizer class fully qualified by its package name.

Example: persistence.xml file

<property name="toplink.session.customizer" value="acme.sessions.MySessionCustomizer"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(TopLinkProperties.SESSION_CUSTOMIZER, "acme.sessions.MySessionCustomizer");
 

toplink.descriptor.customizer.<ENTITY>

Specify a TopLink descriptor customizer class: a Java class that implements the oracle.toplink.essentials.tools.sessionconfiguration.DescriptorCustomizer interface and provides a default (zero-argument) constructor. Use this class's customize method, which takes an oracle.toplink.essentials.descriptors.ClassDescriptor, to programmatically access advanced TopLink descriptor and mapping API for the descriptor associated with the JPA entity named <ENTITY>.

For more information on entity names, see @Entity.

For more information on TopLink descriptors, see:

Valid values: class name of a DescriptorCustomizer class fully qualified by its package name.

Example: persistence.xml file

<property name="toplink.descriptor.customizer.Order" value="acme.sessions.MyDescriptorCustomizer"/>

Example: property Map

import oracle.toplink.essentials.config.TopLinkProperties;
propertiesMap.put(TopLinkProperties.DESCRIPTOR_CUSTOMIZER+".Order", "acme.sessions.MyDescriptorCustomizer");
 

TopLink JPA Extensions for Schema Generation

Table 26-4 lists the TopLink JPA extensions that you can define in a persistence.xml file to configure schema generation.

Table 26-6 TopLink JPA Extensions for Schema Generation

Property Usage Default

toplink.ddl-generation

Specify what data definition language (DDL) generation action you want for your JPA entities. To specify the DDL generation target, see toplink.ddl-generation.output-mode.

Valid values: oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider

Example: persistence.xml file

<property name="toplink.ddl-generation" value="create-tables"/>

Example: property Map

import oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider;
propertiesMap.put(EntityManagerFactoryProvider.DDL_GENERATION, EntityManagerFactoryProvider.CREATE_ONLY);

none

toplink.application-location

Specify where TopLink should write generated DDL files (see toplink.create-ddl-jdbc-file-name and toplink.drop-ddl-jdbc-file-name). Files are written if toplink.ddl-generation is set to anything other than none.

Valid values: a file specification to a directory in which you have write access. The file specification may be relative to your current working directory or absolute. If it does not end in a file separator, TopLink will append one valid for your operating system.

Example: persistence.xml file

<property name="toplink.application-location" value="C:\ddl\"/>

Example: property Map

import oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider;
propertiesMap.put(EntityManagerFactoryProvider.APP_LOCATION, "C:\ddl\");

"."+File.separator

toplink.create-ddl-jdbc-file-name

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

Valid values: a file name valid for your operating system. Optionally, you may prefix the file name with a file path as long as the concatenation of toplink.application-location + toplink.create-ddl-jdbc-file-name is a valid file specification for your operating system.

Example: persistence.xml file

<property name="toplink.create-ddl-jdbc-file-name" value="create.sql"/>

Example: property Map

import oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider;
propertiesMap.put(EntityManagerFactoryProvider.CREATE_JDBC_DDL_FILE, "create.sql");
 

toplink.drop-ddl-jdbc-file-name

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

Valid values: a file name valid for your operating system. Optionally, you may prefix the file name with a file path as long as the concatenation of toplink.application-location + toplink.drop-ddl-jdbc-file-name is a valid file specification for your operating system.

Example: persistence.xml file

<property name="toplink.drop-ddl-jdbc-file-name" value="drop.sql"/>

Example: property Map

import oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider;
propertiesMap.put(EntityManagerFactoryProvider.DROP_JDBC_DDL_FILE, "drop.sql");
 

toplink.ddl-generation.output-mode

Use this property to specify the DDL generation target.

Valid values: oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider

Example: persistence.xml file

<property name="toplink.ddl-generation.output-mode" value="database"/>

Example: property Map

import oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider;
propertiesMap.put(EntityManagerFactoryProvider.DDL_GENERATION_MODE, EntityManagerFactoryProvider.DDL_DATABASE_GENERATION);

Java EE mode (createContainerEntityManagerFactory called): both

Java SE mode (createEntityManagerFactory called): sql-script