Java Reference
In-Depth Information
Entity Persistence Configuration file
The persistence.xml file is the EJB 3.0 database persistence configuration
file and gets generated when entities are created from database tables. But, the
persistence.xml file as generated is not complete. The JTA data source JNDI name
is specified and the entity classes are also specified. EclipseLink is used as the
JPA persistence provider. The javax.persistence.jtaDataSource property is
pre-specified and set to the JTA data source name. Add the following properties to
persistence.xml :
Property
Value
Description
eclipselink.target-
server
WebLogic_10
Specifies the target server as
WebLogic Server 10.
eclipselink.target-
database
Oracle
Specifies the target database.
eclipselink.ddl-
generation
create-tables
Specifies the DDL generation
strategy to create tables, but not to
delete tables and re-create them.
The persistence.xml configuration file is listed as follows:
<?xml version="1.0" encoding="Cp1252" ?>
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name="em">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>
java:/app/jdbc/jdbc/OracleDBConnectionDS
</jta-data-source>
<class>model.Article</class>
<class>model.Edition</class>
<class>model.Section</class>
<properties>
<property name="eclipselink.target-server"
value="WebLogic_10" />
<property name="eclipselink.target-database" value="Oracle" />
<property name="eclipselink.ddl-generation"
value="create-tables" />
<property name="javax.persistence.jtaDataSource"
value="java:/app/jdbc/jdbc/OracleDBConnectionDS" />
</properties>
</persistence-unit>
</persistence>
Search WWH ::




Custom Search