Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be 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/UserGuide/JPA/Basic JPA Development/Configuration/JPA/orm.xml"

m
m (orm.xml)
Line 1: Line 1:
 
=orm.xml=
 
=orm.xml=
 +
Use the '''orm.xml''' file to apply the metadata to the persistence unit. This metadata is a union of all the mapping files and the annotations (if there is no '''xml-mapping-metadata-complete'''  element). If you use one mapping '''orm.xml''' file for your metadata and place this file in a META-INF directory on the classpath, then you do not need to explicitly list it. The EclipseLink persistence provider will automatically search for this file ('''orm.xml''')and use it.
  
 +
If you use a different name for your mapping files, or place them in a different location, you must list them in the '''mapping-file'''  element of the [[EclipseLink/UserGuide/JPA/Basic_JPA_Development/Configuration/JPA/persistence.xml|persistence.xml file]], as shown here:
 +
<source lang="xml">
 +
<persistence-unit name="EmployeeService">
 +
    <jta-data-source>jdbc/EmployeeServiceDS</jta-data-source>
 +
    <mapping-file>META-INF/employee_service_queries.xml</mapping-file>
 +
</persistence-unit>
 +
</source>
 +
{{EclipseLink_Note
 +
|note=In this example, the '''orm.xml''' file is not listed -- the persistence provider finds it by default.
 +
}}
  
 
{{EclipseLink_JPA
 
{{EclipseLink_JPA

Revision as of 14:17, 16 June 2010

orm.xml

Use the orm.xml file to apply the metadata to the persistence unit. This metadata is a union of all the mapping files and the annotations (if there is no xml-mapping-metadata-complete element). If you use one mapping orm.xml file for your metadata and place this file in a META-INF directory on the classpath, then you do not need to explicitly list it. The EclipseLink persistence provider will automatically search for this file (orm.xml)and use it.

If you use a different name for your mapping files, or place them in a different location, you must list them in the mapping-file element of the persistence.xml file, as shown here:

 <persistence-unit name="EmployeeService">
     <jta-data-source>jdbc/EmployeeServiceDS</jta-data-source>
     <mapping-file>META-INF/employee_service_queries.xml</mapping-file>
 </persistence-unit>

Elug note icon.png

Note: In this example, the orm.xml file is not listed -- the persistence provider finds it by default.

Eclipselink-logo.gif
Version: DRAFT
Other versions...

Back to the top