Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/Examples/JPA/Configure"

m (linked to elug)
Line 2: Line 2:
  
 
* Persistence.xml - which defines your persistence units and should be in the meta-inf/
 
* Persistence.xml - which defines your persistence units and should be in the meta-inf/
<code><pre>
+
<source lang="xml">
 
<persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
 
<persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
 
   <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
 
   <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
Line 8: Line 8:
 
   <!-- By default your mappings can be defined in orm.xml file, -->
 
   <!-- By default your mappings can be defined in orm.xml file, -->
 
   <!-- which is discovered automatically.                        -->                                     
 
   <!-- which is discovered automatically.                        -->                                     
   <mapping-file>META-INF/advanced-entity-mappings.xml</mapping-file>
+
   <mapping-file>META-INF/my-mappings.xml</mapping-file>
 
   ...
 
   ...
   <jar-file>jpa-xml-only-model-tests.jar</jar-file>
+
   <jar-file>my-additional-jar.jar</jar-file>
 
   ...
 
   ...
 
   <exclude-unlisted-classes>false</exclude-unlisted-classes>
 
   <exclude-unlisted-classes>false</exclude-unlisted-classes>
Line 18: Line 18:
 
   </properties>
 
   </properties>
 
</persistence-unit>
 
</persistence-unit>
</pre></code>
+
</source>
 
* Entities, Embeddable and MappedSuperclasses
 
* Entities, Embeddable and MappedSuperclasses
 
** These classes should be decorated with the necessary annotations, and/or
 
** These classes should be decorated with the necessary annotations, and/or

Revision as of 14:42, 23 June 2008

To use JPA you will need to have the following configurations available:

  • Persistence.xml - which defines your persistence units and should be in the meta-inf/
<persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
  <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
 
  <!-- By default your mappings can be defined in orm.xml file, -->
  <!-- which is discovered automatically.                        -->                                     
  <mapping-file>META-INF/my-mappings.xml</mapping-file>
  ...
  <jar-file>my-additional-jar.jar</jar-file>
  ...
  <exclude-unlisted-classes>false</exclude-unlisted-classes>
 
  <properties>
    ...
  </properties>
</persistence-unit>
  • Entities, Embeddable and MappedSuperclasses
    • These classes should be decorated with the necessary annotations, and/or
    • Be defined in the orm.xml (or some other mapping file) using the XML descriptors.
  • Properties - use these properties to further configure your JPA application.
    • javax.persistence.transactionType - Standard JPA PersistenceUnitTransactionType property, JTA or RESOURCE_LOCAL.
    • javax.persistence.jtaDataSource - Standard JPA JTA DataSource name.
    • javax.persistence.nonJtaDataSource - Standard JPA non-JTA DataSource name.


See Developing JPA Projects in the EclipseLinkUser's Guide for details.

Back to the top