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

From Eclipsepedia

Jump to: navigation, search
m
m (added xrefs to elug)
Line 22: Line 22:
 
</blockquote>
 
</blockquote>
  
* Entities, Embeddable and MappedSuperclasses
+
 
 +
* [[Introduction_to_EclipseLink_JPA_%28ELUG%29#Configuring_an_Entity|Entities]], [[Introduction_to_EclipseLink_JPA_%28ELUG%29#.40Embeddable|Embeddable]] and [[Introduction_to_EclipseLink_JPA_%28ELUG%29#.40MappedSuperclass|MappedSuperclasses]]
 
** These classes should be decorated with the necessary annotations, and/or
 
** 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.
 
** 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.
 
* Properties - use these properties to further configure your JPA application.
 
** javax.persistence.transactionType - Standard JPA PersistenceUnitTransactionType property, JTA or RESOURCE_LOCAL.
 
** javax.persistence.transactionType - Standard JPA PersistenceUnitTransactionType property, JTA or RESOURCE_LOCAL.

Revision as of 11:06, 16 December 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/ directory.
<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.