Java Reference
In-Depth Information
EntityManager em = emf.createEntityManager();
Application-managed entity managers use either JTA transactions or resource-local
transactions. The transaction type can be specified in the persistence.xml file. The
default transaction type of entity managers in the Java EE server environment is JTA.
In the Java SE environment only the resource-local transactions can be used, as we
are not using an EJB container. The application explicitly manages the resource-local
transactions using an EntityTransaction object acquired from the entity manager:
EntityManager em = emf.createEntityManager();
EntityTransaction tx = em.getTransaction();
//Begin the transaction
// Create and persist new entities
// Commit the transaction
EclipseLink JPA
EclipseLink in Oracle Fusion Middleware 11 g provides a complete implementation
of JPA 1.0. EclipseLink implements all the mandatory features, some of the optional
features and some additional features.
Metadata annotations
An annotation annotates a Java class/method/property with metadata that is
compiled into the Java class file in which the annotation is specified. The compiled
metadata is interpreted at runtime by the JPA persistence provider (EclipseLink JPA)
to manage the persistence implementation. Each annotation has a default value.
Annotations can be applied at three levels: class level, method level, and field level.
EclipseLink JPA also defines some proprietary annotations in the org.eclipselink.
annotations package.
XML mapping metadata
The XML mapping metadata file is used to specify object relational mapping (ORM)
metadata. The default ORM metadata file is META-INF/orm.xml , which is based on
XML Schema . In orm.
xml all the object relational mapping metadata is contained within the root element
entity-mappings . EclipseLink provides a native XML metadata file, META-INF/
eclipselink-orm.xml . The ORM metadata in the eclipselink-orm.xml overrides
the ORM metadata in JPA's XML metadata file.
Search WWH ::

Custom Search