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.
Difference between revisions of "EclipseLink/UserGuide/JPA/Basic JPA Development/Configuration/JPA/orm.xml"
m |
m |
||
Line 1: | Line 1: | ||
{{EclipseLink_UserGuide | {{EclipseLink_UserGuide | ||
|info=y | |info=y | ||
− | }} | + | |toc=n |
+ | |eclipselink=y | ||
+ | |eclipselinktype=JPA}} | ||
=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. | 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. | ||
Line 33: | Line 35: | ||
|next=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Configuration/JPA/Defaults|Defaults]] | |next=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Configuration/JPA/Defaults|Defaults]] | ||
|up=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Configuration|Configuration]] | |up=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Configuration|Configuration]] | ||
− | |version=2. | + | |version=2.2.0 DRAFT}} |
Revision as of 10:45, 12 January 2011
EclipseLink JPA
EclipseLink | |
Website | |
Download | |
Community | |
Mailing List • Forums • IRC • mattermost | |
Issues | |
Open • Help Wanted • Bug Day | |
Contribute | |
Browse Source |
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>
Note: In this example, the orm.xml file is not listed -- the persistence provider finds it by default.
Advantages and Disadvantages of Using XML
Some advantages of using XML instead of Annotations include:
- No coupling between the metadata and the source code
- Compliance with the existing, pre-EJB 3.0 development process
- Support in IDEs and source control systems
The main disadvantages of mapping with XML include:
- Its inherent complexitiy (when compared to annotations)
- The need for replication of the code context