Java Reference
In-Depth Information
}
public void setTitle(String title) {
this.title = title;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
}
The Entity configuration file
The persistence.xml configuration file specifies a persistence unit, including a
jta-data-source for the entity bean. The entity bean is persisted to the database
using the data source specified in the persistence.xml file. A persistence unit
is associated with the EntityManager when an EntityManager is injected into
a session bean, which we shall discuss in the next section. The persistence.xml
file also specifies the JPA persistence provider as EclipseLink . Add a property
for the target server with WebLogic_10 as the target server. The persistence.xml
configuration file is listed below:
<?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>jdbc/OracleDBConnectionDS</jta-data-source>
<class>model.Catalog</class>
<properties>
<property name="eclipselink.target-server"
value="WebLogic_10" />
<property name="javax.persistence.jtaDataSource"
value="jdbc/OracleDBConnectionDS" />
</properties>
</persistence-unit>
</persistence>
 
Search WWH ::




Custom Search