| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" /> |
| <meta http-equiv="Content-Style-Type" content="text/css" /> |
| <meta http-equiv="Content-Script-Type" content="text/javascript" /> |
| <title>eclipselink-orm.xml Schema Reference | EclipseLink 2.7.x Java Persistence API (JPA) Extensions Reference</title> |
| <meta name="generator" content="Oracle DARB XHTML Converter (Mode = document) - Version 1.0.22 Build 1" /> |
| <meta name="date" content="2014-06-10T10:29:49Z" /> |
| <meta name="description" content="This chapter describes how you can use EclipseLink's native metadata XML file, eclipselink-orm.xml, to override mappings defined in the JPA configuration file (orm." /> |
| <meta name="robots" content="noarchive" /> |
| <meta name="doctitle" content="eclipselink-orm.xml Schema Reference" /> |
| <meta name="relnum" content="Release 2.7" /> |
| <link rel="stylesheet" type="text/css" href="../../../dcommon/style.css" media="screen" /> |
| <link rel="copyright" href="http://www.eclipse.org/org/documents/epl-v10.php" title="Copyright" type="text/html" /> |
| <link rel="start" href="../../index.htm" title="Home" type="text/html" /> |
| <link rel="contents" href="toc.htm" title="Contents" type="text/html" /> |
| <link rel="prev" href="persistenceproperties_ref.htm" title="Previous" type="text/html" /> |
| <!-- START: Disqus --><script type="text/javascript"> var disqus_developer = 0; </script><!-- END: Disqus --><!-- START: Sharethis --><script type="text/javascript">var switchTo5x=true;</script><script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script><script type="text/javascript" src="http://s.sharethis.com/loader.js"></script> <!-- END: Sharethis --></head> |
| <body bgcolor="#FFFFFF"><iframe id="docheader" frameborder="0" framemargin="0" scrolling="no" src="../../../dcommon/header.html"></iframe><script src="http://www.google.com/jsapi" type="text/javascript"></script><script type="text/javascript"> google.load('search', '1', {language : 'en'}); google.setOnLoadCallback(function() { var customSearchOptions = {}; var googleAnalyticsOptions = {}; googleAnalyticsOptions['queryParameter'] = 'q'; googleAnalyticsOptions['categoryParameter'] = ''; customSearchOptions['googleAnalyticsOptions'] = googleAnalyticsOptions; var customSearchControl = new google.search.CustomSearchControl( '016171230611334810008:4sqnhke2any', customSearchOptions); customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET); var options = new google.search.DrawOptions(); options.setSearchFormRoot('cse-search-form'); customSearchControl.draw('cse', options); }, true);</script><link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css" type="text/css" /><div id="cse" style="width:100%;"></div> |
| <div class="header"><a id="top" name="top"></a> |
| <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> |
| <tr> |
| <td align="left" valign="top"><div class="booktitle">Java Persistence API (JPA) Extensions Reference for EclipseLink, |
| Release 2.7</div></td> |
| <td valign="bottom" align="right" width="144"> |
| <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> |
| <tr> |
| <td> </td> |
| <td align="center" valign="top"><a href="toc.htm"><img src="../../../dcommon/images/contents.png" alt="Go To Table Of Contents" border="0" height="16" width="16" /><br /> |
| </td><td> </td><td align="center"><a href="../../../" target="_top" class="external text" title="Search" rel="nofollow"><img src="../../../dcommon/images/search.png" alt="Search" style="border:0;" /><br /><span class="mini"></span></a></td><td> </td><td align="center"><a href="../../eclipselink_jpa_extensions.pdf" title="PDF" target="_blank"><img src="../../../dcommon/images/pdf_icon.png" style="padding-right:5px;border:0" alt="PDF"></a></td><td align="center"><a href="#disqus_thread" title="Comments""><img src="../../../dcommon/images/comments.png" style="padding-right:5px;border:0" alt="Comments"><br /><span class="mini">Comments</span></a> |
| </tr> |
| </table> |
| </td> |
| </tr> |
| </table> |
| <hr /> |
| <table class="navigation simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100" align="center"> |
| <tr> |
| <td align="center"><a href="persistenceproperties_ref.htm"><img src="../../../dcommon/images/larrow.png" alt="Previous" border="0" height="16" width="16" /></a></td> |
| <td> </td> |
| </tr> |
| </table> |
| </div> |
| <!-- class="header" --> |
| <div class="ind"><!-- End Header --><a id="TLJPA688" name="TLJPA688"></a> <a id="sthref1245" name="sthref1245"></a> |
| <h1 class="chapter"><font face="arial, helvetica, sans-serif" color="#330099"><span class="secnum">6</span> eclipselink-orm.xml Schema Reference</font></h1> |
| <a id="TLJPA54097" name="TLJPA54097"></a> |
| <p>This chapter describes how you can use EclipseLink's native metadata XML file, <code>eclipselink-orm.xml</code>, to override mappings defined in the JPA configuration file (<code>orm.xml</code>) and to provide extended ORM features.</p> |
| <div align="center"> |
| <div class="inftblnote"><br /> |
| <table class="Note oac_no_warn" summary="" border="1" width="80%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0"> |
| <tbody> |
| <tr> |
| <td align="left"> |
| <p class="note"><img src="../../../dcommon/images/note_icon.png" width="16" height="16" alt="Note" style="vertical-align:middle;padding-right:5px;" />Note:</p> |
| <p>Using the <code>eclipselink-orm.xml</code> mapping file enables many EclipseLink advanced features, but it may prevent the persistence unit from being portable to other JPA implementations.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| <br /></div> |
| <!-- class="inftblnote" --></div> |
| <p>The <code>eclipselink-orm.xml</code> file defines object-relational mapping metadata for EclipseLink. It has the same basic structure as the <code>orm.xml</code> file, which makes it more intuitive, requires minimum configuration, and makes it easy to override.</p> |
| <p>For more information, see:</p> |
| <ul> |
| <li> |
| <p>Section 12.2 "XML Overriding Rules" in the JPA Specification</p> |
| </li> |
| <li> |
| <p><code><a href="http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Configuration/JPA/orm.xml">http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Configuration/JPA/orm.xml</a></code></p> |
| </li> |
| </ul> |
| <p>The schema for EclipseLink is <code>eclipselink_orm_X_X.xsd</code> where X_X is the current EclipseLink version number (such as <code>2_4</code> for <strong>2.4</strong>). All EclipseLink schemas are available from <code><a href="http://wiki.eclipse.org/EclipseLink/XSDs">http://wiki.eclipse.org/EclipseLink/XSDs</a></code>.</p> |
| <p>This chapter includes the following sections:</p> |
| <ul> |
| <li> |
| <p><a href="#BGBBEIEA">Overriding and Merging</a></p> |
| </li> |
| </ul> |
| <a id="BGBBEIEA" name="BGBBEIEA"></a><a id="TLJPA689" name="TLJPA689"></a> |
| <div class="sect1"><!-- infolevel="all" infotype="General" --> |
| <h2 class="sect1"><font face="arial, helvetica, sans-serif" color="#330099">Overriding and Merging</font></h2> |
| <p>To override the <code>orm.xml</code> file's mapping, you must define the <code>META-INF/eclipselink-orm.xml</code> file in the project. When both <code>orm.xml</code> and <code>eclipselink-orm.xml</code> are specified, the contents of <code>eclipselink-orm.xml</code> will override <code>orm.xml</code> and any other JPA mapping file specified in the persistence unit. If there are overlapping specifications in multiple ORM files, the files are merged if they are no conflicting entities.</p> |
| <div align="center"> |
| <div class="inftblnote"><br /> |
| <table class="Note oac_no_warn" summary="" border="1" width="80%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0"> |
| <tbody> |
| <tr> |
| <td align="left"> |
| <p class="note"><img src="../../../dcommon/images/note_icon.png" width="16" height="16" alt="Note" style="vertical-align:middle;padding-right:5px;" />Note:</p> |
| <p>The order of files defined in <code>persistence.xml</code> <em>does not</em> define the order of their processing. The files are processed, merged, and overridden as determined by the rules.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| <br /></div> |
| <!-- class="inftblnote" --></div> |
| <p>See the following sections for more information:</p> |
| <ul> |
| <li> |
| <p><a href="#BGBJBFDH">Rules for Overriding and Merging</a></p> |
| </li> |
| <li> |
| <p><a href="#BGBGFDDF">Examples of Overriding and Merging</a></p> |
| </li> |
| </ul> |
| <a id="BGBJBFDH" name="BGBJBFDH"></a><a id="TLJPA690" name="TLJPA690"></a> |
| <div class="sect2"><!-- infolevel="all" infotype="General" --> |
| <h3 class="sect2"><font face="arial, helvetica, sans-serif" color="#330099">Rules for Overriding and Merging</font></h3> |
| <p>EclipseLink provides specific overriding and merging rules for the following elements defined in the <code>orm.xml</code> file:</p> |
| <ul> |
| <li> |
| <p><a href="#BGBFCDBF">Persistence Unit Metadata</a></p> |
| </li> |
| <li> |
| <p><a href="#BGBDIICB">Entity Mappings</a></p> |
| </li> |
| <li> |
| <p><a href="#BGBIAAAH">Mapped Superclasses</a></p> |
| </li> |
| <li> |
| <p><a href="#BGBJAIBF">Entity override and merging rules</a></p> |
| </li> |
| <li> |
| <p><a href="#BGBIJGGA">Embeddable</a></p> |
| </li> |
| </ul> |
| <a id="BGBFCDBF" name="BGBFCDBF"></a><a id="TLJPA691" name="TLJPA691"></a> |
| <div class="sect3"> |
| <h4 class="sect3"><font face="arial, helvetica, sans-serif" color="#330099">Persistence Unit Metadata</font></h4> |
| <p>In <code>eclipselink-orm.xml</code>, a <code>persistence-unit-metadata</code> element merges or overrides the values of existing <code>persistence-unit-metadata</code> specification as defined in <a href="#BGBGIFHH">Table 6-1</a>.</p> |
| <div class="tblhruleformalwide"><a id="TLJPA692" name="TLJPA692"></a><a id="sthref1246" name="sthref1246"></a><a id="BGBGIFHH" name="BGBGIFHH"></a> |
| <p><strong><em><font face="arial, helvetica, sans-serif">Table 6-1 Overriding and Merging Persistence Unit Metadata</font></em></strong></p> |
| <table class="HRuleFormalWide" title="Overriding and Merging Persistence Unit Metadata" summary="This table outlines overriding and merging persistence unit metadata. There are three columns: entity-mappings/persistence-unit-metadata, rule, and description." dir="ltr" border="1" width="100%" frame="hsides" rules="rows" cellpadding="3" cellspacing="0"> |
| <col width="29%" /> |
| <col width="18%" /> |
| <col width="*" /> |
| <thead> |
| <tr align="left" valign="top"> |
| <th align="left" valign="bottom" id="r1c1-t4"><font face="Arial, Helvetica, sans-serif"><strong>entity-mappings/ persistence-unit-metadata</strong></font></th> |
| <th align="left" valign="bottom" id="r1c2-t4"><font face="Arial, Helvetica, sans-serif"><strong>Rule</strong></font></th> |
| <th align="left" valign="bottom" id="r1c3-t4"><font face="Arial, Helvetica, sans-serif"><strong>Description</strong></font></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr align="left" valign="top"> |
| <td align="left" id="r2c1-t4" headers="r1c1-t4"> |
| <p><code>xml-mapping-metadata- complete</code></p> |
| </td> |
| <td align="left" headers="r2c1-t4 r1c2-t4"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r2c1-t4 r1c3-t4"> |
| <p>If specified, the complete set of mapping metadata for the persistence unit is contained in the XML mapping files for the persistence unit.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r3c1-t4" headers="r1c1-t4"> |
| <p><code>persistence-unit-defaults/ schema</code></p> |
| </td> |
| <td align="left" headers="r3c1-t4 r1c2-t4"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r3c1-t4 r1c3-t4"> |
| <p>If a <code>schema</code> setting exists, then the <code>eclipselink-orm.xml</code> <code>schema</code> setting overrides the existing setting or creates a new <code>schema</code> setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r4c1-t4" headers="r1c1-t4"> |
| <p><code>persistence-unit-defaults/ catalog</code></p> |
| </td> |
| <td align="left" headers="r4c1-t4 r1c2-t4"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r4c1-t4 r1c3-t4"> |
| <p>If a <code>catalog</code> setting exists, then the <code>eclipselink-orm.xml</code> <code>catalog</code> setting overrides the existing setting or creates a new <code>catalog</code> setting</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r5c1-t4" headers="r1c1-t4"> |
| <p><code>persistence-unit-defaults/ access</code></p> |
| </td> |
| <td align="left" headers="r5c1-t4 r1c2-t4"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r5c1-t4 r1c3-t4"> |
| <p>If an <code>access</code> setting exists, then the <code>eclipselink-orm.xml</code> <code>access</code> setting overrides the existing setting, or creates a new <code>access</code> setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r6c1-t4" headers="r1c1-t4"> |
| <p><code>entity-mappings/persistence-unit-metadata/persistence-unit-defaults/cascade- persist</code></p> |
| </td> |
| <td align="left" headers="r6c1-t4 r1c2-t4"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r6c1-t4 r1c3-t4"> |
| <p>If a <code>cascade-persist</code> setting exists, then the <code>eclipselink-orm.xml</code> <code>cascade-persist</code> setting overrides the existing setting or creates a new <code>cascade-persist</code> setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r7c1-t4" headers="r1c1-t4"> |
| <p><code>entity-mappings/persistence-unit-metadata/persistence-unit-defaults/entity- listeners</code></p> |
| </td> |
| <td align="left" headers="r7c1-t4 r1c2-t4"> |
| <p>Merge</p> |
| </td> |
| <td align="left" headers="r7c1-t4 r1c3-t4"> |
| <p>If an <code>entity-listeners</code> exists, then the <code>eclipselink-orm.xml</code> <code>entity-listeners</code> will be merged with the list of all <code>entity-listeners</code> from the persistence unit</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| <br /></div> |
| <!-- class="tblhruleformalwide" --></div> |
| <!-- class="sect3" --> |
| <a id="BGBDIICB" name="BGBDIICB"></a><a id="TLJPA693" name="TLJPA693"></a> |
| <div class="sect3"><!-- infolevel="all" infotype="General" --> |
| <h4 class="sect3"><font face="arial, helvetica, sans-serif" color="#330099">Entity Mappings</font></h4> |
| <p>Entities, embeddables and mapped superclasses are defined within the <code>entity-mappings</code> section. The <code>eclipselink-orm.xml</code> entities, embeddables and mapped superclasses are added to the persistence unit as defined in <a href="#BGBJEBHG">Table 6-2</a>.</p> |
| <div class="tblhruleformalwide"><a id="TLJPA694" name="TLJPA694"></a><a id="sthref1247" name="sthref1247"></a><a id="BGBJEBHG" name="BGBJEBHG"></a> |
| <p><strong><em><font face="arial, helvetica, sans-serif">Table 6-2 Overriding and Merging Entity Mappings</font></em></strong></p> |
| <table class="HRuleFormalWide" title="Overriding and Merging Entity Mappings" summary="This table outlines overriding and merging entity mappings. There are three columns: entity-mapping, rule, and description." dir="ltr" border="1" width="100%" frame="hsides" rules="rows" cellpadding="3" cellspacing="0"> |
| <col width="24%" /> |
| <col width="13%" /> |
| <col width="*" /> |
| <thead> |
| <tr align="left" valign="top"> |
| <th align="left" valign="bottom" id="r1c1-t5"><font face="Arial, Helvetica, sans-serif"><strong><code>entity-mappings/</code></strong></font></th> |
| <th align="left" valign="bottom" id="r1c2-t5"><font face="Arial, Helvetica, sans-serif"><strong>Rule</strong></font></th> |
| <th align="left" valign="bottom" id="r1c3-t5"><font face="Arial, Helvetica, sans-serif"><strong>Description</strong></font></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr align="left" valign="top"> |
| <td align="left" id="r2c1-t5" headers="r1c1-t5"> |
| <p><code>package</code></p> |
| </td> |
| <td align="left" headers="r2c1-t5 r1c2-t5"> |
| <p>None</p> |
| </td> |
| <td align="left" headers="r2c1-t5 r1c3-t5"> |
| <p>The <code>package</code> element specifies the package of the classes listed within the subelements and attributes of the same mapping file only. It is only applicable to those entities that are fully defined within the <code>eclipselink-orm.xml</code> file, else its usage remains local and is same as described in the JPA specification.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r3c1-t5" headers="r1c1-t5"> |
| <p><code>catalog</code></p> |
| </td> |
| <td align="left" headers="r3c1-t5 r1c2-t5"> |
| <p>None</p> |
| </td> |
| <td align="left" headers="r3c1-t5 r1c3-t5"> |
| <p>The <code>catalog</code> element applies only to the subelements and attributes listed within the <code>eclipselink-orm.xml</code> file that are not an extension to another mapping file. Otherwise, the use of the catalog element within the <code>eclipselink-orm.xml</code> file remains local and is same as described in the JPA specification.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r4c1-t5" headers="r1c1-t5"> |
| <p><code>schema</code></p> |
| </td> |
| <td align="left" headers="r4c1-t5 r1c2-t5"> |
| <p>None</p> |
| </td> |
| <td align="left" headers="r4c1-t5 r1c3-t5"> |
| <p>The schema element applies only to the subelements and attributes listed within the <code>eclipselink-orm.xml</code> file that are not an extension to another mapping file. Otherwise, the use of the schema element within the <code>eclipselink-orm.xml</code> file remains local and is same as described in the JPA specification.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r5c1-t5" headers="r1c1-t5"> |
| <p><code>access</code></p> |
| </td> |
| <td align="left" headers="r5c1-t5 r1c2-t5"> |
| <p>None</p> |
| </td> |
| <td align="left" headers="r5c1-t5 r1c3-t5"> |
| <p>The access element applies only to the subelements and attributes listed within the <code>eclipselink-orm.xml</code> file that are not an extension to another mapping file. Otherwise, the use of the access element within the <code>eclipselink-orm.xml</code> file remains local and is same as described in the JPA specification.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r6c1-t5" headers="r1c1-t5"> |
| <p><code>sequence-generator</code></p> |
| </td> |
| <td align="left" headers="r6c1-t5 r1c2-t5"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r6c1-t5 r1c3-t5"> |
| <p>A <code>sequence-generator</code> is unique by name. The sequence-generator defined in the <code>eclipselink-orm.xml</code> will override a sequence-generator of the same name defined in another mapping file. Outside of the overriding case, an exception is thrown if two or more <code>sequence-generators</code> with the same name are defined in one or across multiple mapping files.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r7c1-t5" headers="r1c1-t5"> |
| <p><code>table-generator</code></p> |
| </td> |
| <td align="left" headers="r7c1-t5 r1c2-t5"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r7c1-t5 r1c3-t5"> |
| <p>A <code>table-generator</code> is unique by name. The table-generator defined in the <code>eclipselink-orm.xml</code> will override a table-generator of the same name defined in another mapping file. Outside of the overriding case, an exception is thrown if two or more <code>table-generators</code> with the same name are defined in one or across multiple mapping files.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r8c1-t5" headers="r1c1-t5"> |
| <p><code>named-query</code></p> |
| </td> |
| <td align="left" headers="r8c1-t5 r1c2-t5"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r8c1-t5 r1c3-t5"> |
| <p>A <code>named-query</code> is unique by name. The named-query defined in the <code>eclipselink-orm.xml</code> will override a named-query of the same name defined in other mapping files. Outside of the overriding case, an exception is thrown if two or more <code>named-querys</code> with the same name are defined in one or across multiple mapping file.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r9c1-t5" headers="r1c1-t5"> |
| <p><code>named-native-query</code></p> |
| </td> |
| <td align="left" headers="r9c1-t5 r1c2-t5"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r9c1-t5 r1c3-t5"> |
| <p>A <code>named-native-query</code> is unique by name. The <code>named-native-query</code> defined in the <code>eclipselink-orm.xml</code> will override a <code>named-native-query</code> of the same name defined in other mapping files. Outside of the overriding case, an exception is thrown if two or more <code>named-native-querys</code> with the same name are defined in one or across multiple mapping files.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r10c1-t5" headers="r1c1-t5"> |
| <p><code>sql-result-set-mapping</code></p> |
| </td> |
| <td align="left" headers="r10c1-t5 r1c2-t5"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r10c1-t5 r1c3-t5"> |
| <p>A <code>sql-result-set-mapping</code> is unique by name. The sql-result-set-mapping defined in the <code>eclipselink-orm.xml</code> will override a <code>sql-result-set-mapping</code> of the same name defined in other mapping files. Outside of the overriding case, an exception is thrown if two or more <code>sql-result-set-mapping</code> entities with the same name are defined in one or across multiple mapping files.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| <br /></div> |
| <!-- class="tblhruleformalwide" --></div> |
| <!-- class="sect3" --> |
| <a id="BGBIAAAH" name="BGBIAAAH"></a><a id="TLJPA695" name="TLJPA695"></a> |
| <div class="sect3"><!-- infolevel="all" infotype="General" --> |
| <h4 class="sect3"><font face="arial, helvetica, sans-serif" color="#330099">Mapped Superclasses</font></h4> |
| <p>A mapped-superclass can be defined completely, or with specific elements to provide extensions to a mapped-superclass from another mapping file. <a href="#BGBBFABH">Table 6-3</a> lists individual override and merging rules:</p> |
| <div class="tblhruleformalwide"><a id="TLJPA696" name="TLJPA696"></a><a id="sthref1248" name="sthref1248"></a><a id="BGBBFABH" name="BGBBFABH"></a> |
| <p><strong><em><font face="arial, helvetica, sans-serif">Table 6-3 Overriding and Merging Mapped Superclasses</font></em></strong></p> |
| <table class="HRuleFormalWide" title="Overriding and Merging Mapped Superclasses" summary="This table outlines overriding and merging mapped superclasses. There are three columns: entity-mappings/mapped-superclass, rule, and description." dir="ltr" border="1" width="100%" frame="hsides" rules="rows" cellpadding="3" cellspacing="0"> |
| <col width="25%" /> |
| <col width="18%" /> |
| <col width="*" /> |
| <thead> |
| <tr align="left" valign="top"> |
| <th align="left" valign="bottom" id="r1c1-t6"><font face="Arial, Helvetica, sans-serif"><strong><code>entity-mappings/mapped-superclass</code></strong></font></th> |
| <th align="left" valign="bottom" id="r1c2-t6"><font face="Arial, Helvetica, sans-serif"><strong>Rule</strong></font></th> |
| <th align="left" valign="bottom" id="r1c3-t6"><font face="Arial, Helvetica, sans-serif"><strong>Description</strong></font></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr align="left" valign="top"> |
| <td align="left" id="r2c1-t6" headers="r1c1-t6"> |
| <p><code>id-class</code></p> |
| </td> |
| <td align="left" headers="r2c1-t6 r1c2-t6"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r2c1-t6 r1c3-t6"> |
| <p>If an <code>id-class</code> exists, then the <code>eclipselink-orm.xml</code> <code>id-class</code> setting overrides the existing setting, or creates a new <code>id-class</code> setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r3c1-t6" headers="r1c1-t6"> |
| <p><code>exclude-default- listeners</code></p> |
| </td> |
| <td align="left" headers="r3c1-t6 r1c2-t6"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r3c1-t6 r1c3-t6"> |
| <p>If an <code>exclude-default-listeners</code> exists, then the <code>eclipselink-orm.xml</code> <code>exclude-default-listeners</code> setting will be applied. If the <code>exclude-default-listeners</code> setting is not specified, it will not override an existing setting, that is essentially turning it off.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r4c1-t6" headers="r1c1-t6"> |
| <p><code>exclude-superclass- listeners</code></p> |
| </td> |
| <td align="left" headers="r4c1-t6 r1c2-t6"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r4c1-t6 r1c3-t6"> |
| <p>If an <code>exclude-superclass-listeners</code> setting exists, then the <code>eclipselink-orm.xml</code> <code>exclude-superclass-listeners</code> setting will be applied. If exclud<code>e-superclass-listen</code>ers setting is not specified, it will not override an existing setting, that is essentially turning it off.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r5c1-t6" headers="r1c1-t6"> |
| <p><code>entity-listeners</code></p> |
| </td> |
| <td align="left" headers="r5c1-t6 r1c2-t6"> |
| <p>Merge and full override</p> |
| </td> |
| <td align="left" headers="r5c1-t6 r1c3-t6"> |
| <p>If an <code>entity-listeners</code> setting exists, then the <code>eclipselink-orm.xml</code> <code>entity-listeners</code> setting will override and merge with an existing setting, or creates a new <code>entity-listeners</code> setting all together.</p> |
| <p><strong>Note:</strong> An entity listener override must be complete. All lifecycle methods of that listener must be specified and no merging of individual lifecycle methods of an entity listener is allowed. The class name of the listener is the key to identify the override.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r6c1-t6" headers="r1c1-t6"> |
| <p><code>pre-persist</code></p> |
| </td> |
| <td align="left" headers="r6c1-t6 r1c2-t6"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r6c1-t6 r1c3-t6"> |
| <p>If a <code>pre-persist</code> setting exists, then the <code>eclipselink-orm.xml</code> <code>pre-persist</code> setting overrides the existing setting, or creates a new <code>pre-persist</code> setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r7c1-t6" headers="r1c1-t6"> |
| <p><code>post-persist</code></p> |
| </td> |
| <td align="left" headers="r7c1-t6 r1c2-t6"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r7c1-t6 r1c3-t6"> |
| <p>If a <code>post-persist</code> setting exists, then the <code>eclipselink-orm.xml</code> <code>post-persist</code> setting overrides the existing setting, or creates a new <code>post-persist</code> setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r8c1-t6" headers="r1c1-t6"> |
| <p><code>pre-remove</code></p> |
| </td> |
| <td align="left" headers="r8c1-t6 r1c2-t6"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r8c1-t6 r1c3-t6"> |
| <p>If a pre-remove setting exists, then the eclipselink-orm.xml's pre-remove setting overrides the existing setting, or creates a new pre-remove setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r9c1-t6" headers="r1c1-t6"> |
| <p><code>post-remove</code></p> |
| </td> |
| <td align="left" headers="r9c1-t6 r1c2-t6"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r9c1-t6 r1c3-t6"> |
| <p>If a post-remove setting exists, then the eclipselink-orm.xml's post-remove setting overrides the existing setting, or creates a new post-remove setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r10c1-t6" headers="r1c1-t6"> |
| <p><code>pre-update</code></p> |
| </td> |
| <td align="left" headers="r10c1-t6 r1c2-t6"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r10c1-t6 r1c3-t6"> |
| <p>If a pre-update setting exists, then the eclipselink-orm.xml's pre-update setting overrides the existing setting, or creates a new pre-update setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r11c1-t6" headers="r1c1-t6"> |
| <p><code>post-update</code></p> |
| </td> |
| <td align="left" headers="r11c1-t6 r1c2-t6"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r11c1-t6 r1c3-t6"> |
| <p>If a post-update setting exists, then the eclipselink-orm.xml's post-update setting overrides the existing setting, or creates a new post-update setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r12c1-t6" headers="r1c1-t6"> |
| <p><code>post-load</code></p> |
| </td> |
| <td align="left" headers="r12c1-t6 r1c2-t6"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r12c1-t6 r1c3-t6"> |
| <p>If a post-load setting exists, then the eclipselink-orm.xml's post-load setting overrides the existing setting, or creates a new post-load setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r13c1-t6" headers="r1c1-t6"> |
| <p><code>attributes</code></p> |
| </td> |
| <td align="left" headers="r13c1-t6 r1c2-t6"> |
| <p>Merge and mapping level override</p> |
| </td> |
| <td align="left" headers="r13c1-t6 r1c3-t6"> |
| <p>If the <code>attribute</code> settings (such as <code>id</code>, <code>embedded-id</code>, <code>basic</code>, <code>version</code>, <code>many-to-one</code>, <code>one-to-many</code>, or <code>one-to-one</code>) exist at the mapping level, then the <code>eclipselink-orm.xml</code> attributes merges or overrides the existing settings, else creates new attributes.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r14c1-t6" headers="r1c1-t6"> |
| <p><code>class</code></p> |
| </td> |
| <td align="left" headers="r14c1-t6 r1c2-t6"> |
| <p>None</p> |
| </td> |
| <td align="left" headers="r14c1-t6 r1c3-t6"><br /></td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r15c1-t6" headers="r1c1-t6"> |
| <p><code>access</code></p> |
| </td> |
| <td align="left" headers="r15c1-t6 r1c2-t6"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r15c1-t6 r1c3-t6"> |
| <p>If an access setting exists, then the eclipselink-orm.xml's access setting overrides the existing setting, or creates a new access setting. It also overrides the default class setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r16c1-t6" headers="r1c1-t6"> |
| <p><code>metadata-complete</code></p> |
| </td> |
| <td align="left" headers="r16c1-t6 r1c2-t6"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r16c1-t6 r1c3-t6"> |
| <p>If a metadata-complete setting exists, then the eclipselink-orm.xml's metadata-complete setting will be applied. If metadata-complete setting is not specified, it will not override an existing setting, that is essentially turning it off.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| <br /></div> |
| <!-- class="tblhruleformalwide" --></div> |
| <!-- class="sect3" --> |
| <a id="BGBJAIBF" name="BGBJAIBF"></a><a id="TLJPA697" name="TLJPA697"></a> |
| <div class="sect3"><!-- infolevel="all" infotype="General" --> |
| <h4 class="sect3"><font face="arial, helvetica, sans-serif" color="#330099">Entity override and merging rules</font></h4> |
| <p>An entity can be defined completely, or with specific elements to provide extensions to an entity from another mapping file. The following table lists individual override and merging rules:</p> |
| <div class="tblhruleformalwide"><a id="TLJPA698" name="TLJPA698"></a><a id="sthref1249" name="sthref1249"></a><a id="BGBEDIBC" name="BGBEDIBC"></a> |
| <p><strong><em><font face="arial, helvetica, sans-serif">Table 6-4 Overriding and Merging Entities</font></em></strong></p> |
| <table class="HRuleFormalWide" title="Overriding and Merging Entities" summary="This table outlines overriding and merging entities. There are three columns: entity-mappings/entity, rule, and description." dir="ltr" border="1" width="100%" frame="hsides" rules="rows" cellpadding="3" cellspacing="0"> |
| <col width="31%" /> |
| <col width="21%" /> |
| <col width="*" /> |
| <thead> |
| <tr align="left" valign="top"> |
| <th align="left" valign="bottom" id="r1c1-t7"><font face="Arial, Helvetica, sans-serif"><strong>entity-mappings/entity</strong></font></th> |
| <th align="left" valign="bottom" id="r1c2-t7"><font face="Arial, Helvetica, sans-serif"><strong>Rule</strong></font></th> |
| <th align="left" valign="bottom" id="r1c3-t7"><font face="Arial, Helvetica, sans-serif"><strong>Description</strong></font></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr align="left" valign="top"> |
| <td align="left" id="r2c1-t7" headers="r1c1-t7"> |
| <p><code>table</code></p> |
| </td> |
| <td align="left" headers="r2c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r2c1-t7 r1c3-t7"> |
| <p>The table definition overrides any other table setting (with the same name) for this entity. There is no merging of individual table values.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r3c1-t7" headers="r1c1-t7"> |
| <p><code>secondary-table</code></p> |
| </td> |
| <td align="left" headers="r3c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r3c1-t7 r1c3-t7"> |
| <p>The secondary-table definition overrides another secondary-table setting (with the same name) for this entity. There is no merging of individual secondary-table(s) values.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r4c1-t7" headers="r1c1-t7"> |
| <p><code>primary-key-join-column</code></p> |
| </td> |
| <td align="left" headers="r4c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r4c1-t7 r1c3-t7"> |
| <p>The primary-key-join-column(s) definition overrides any other primary-key-join-column(s) setting for this entity. There is no merging of the primary-key-join-column(s). The specification is assumed to be complete and these primary-key-join-columns are the source of truth.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r5c1-t7" headers="r1c1-t7"> |
| <p><code>id-class</code></p> |
| </td> |
| <td align="left" headers="r5c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r5c1-t7 r1c3-t7"> |
| <p>If an id-class setting exists, then the eclipselink-orm.xml's id-class setting overrides the existing setting, or creates a new id-class .</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r6c1-t7" headers="r1c1-t7"> |
| <p><code>inheritance</code></p> |
| </td> |
| <td align="left" headers="r6c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r6c1-t7 r1c3-t7"> |
| <p>If an inheritance setting exists, then the eclipselink-orm.xml's inheritance setting overrides the existing setting, or creates a new inheritance setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r7c1-t7" headers="r1c1-t7"> |
| <p><code>discriminator-value</code></p> |
| </td> |
| <td align="left" headers="r7c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r7c1-t7 r1c3-t7"> |
| <p>If a discriminator-value setting exists, then the eclipselink-orm.xml's discriminator-value setting overrides the existing setting, or creates a new discriminator-value setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r8c1-t7" headers="r1c1-t7"> |
| <p><code>discriminator-column</code></p> |
| </td> |
| <td align="left" headers="r8c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r8c1-t7 r1c3-t7"> |
| <p>If a discriminator-column setting exists, then the eclipselink-orm.xml's discriminator-column setting overrides the existing setting, or creates a new discriminator-column setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r9c1-t7" headers="r1c1-t7"> |
| <p><code>sequence-generator</code></p> |
| </td> |
| <td align="left" headers="r9c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r9c1-t7 r1c3-t7"> |
| <p>A sequence-generator is unique by name. The sequence-generator defined in eclipselink-orm.xml overrides sequence-generator of the same name defined in other mapping files. Outside of the overriding case, an exception is thrown if two or more sequence-generators with the same name are defined in one or across multiple mapping files.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r10c1-t7" headers="r1c1-t7"> |
| <p><code>table-generator</code></p> |
| </td> |
| <td align="left" headers="r10c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r10c1-t7 r1c3-t7"> |
| <p>A table-generator is unique by name. The table-generator defined in eclipselink-orm.xml overrides table-generator of the same name defined in other mapping files. Outside of the overriding case, an exception is thrown if two or more table-generators with the same name are defined in one or across multiple mapping files.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r11c1-t7" headers="r1c1-t7"> |
| <p><code>named-query</code></p> |
| </td> |
| <td align="left" headers="r11c1-t7 r1c2-t7"> |
| <p>Merge and full override</p> |
| </td> |
| <td align="left" headers="r11c1-t7 r1c3-t7"> |
| <p>A named-query is unique by name. The named-query defined in eclipselink-orm.xml overrides any named-query of the same name defined in other mapping files. Outside of the overriding case, an exception is thrown if two or more <code>named-query</code> elements with the same name are defined in one or across multiple mapping files.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r12c1-t7" headers="r1c1-t7"> |
| <p><code>named-native-query</code></p> |
| </td> |
| <td align="left" headers="r12c1-t7 r1c2-t7"> |
| <p>Merge and full override</p> |
| </td> |
| <td align="left" headers="r12c1-t7 r1c3-t7"> |
| <p>A named-native-query is unique by name. The named-native-query defined in eclipselink-orm.xml overrides named-native-query of the same name defined in other mapping files. Outside of the overriding case, an exception is thrown if two or more named-native-query elements with the same name are defined in one or across multiple mapping files.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r13c1-t7" headers="r1c1-t7"> |
| <p><code>sql-result-set-mapping</code></p> |
| </td> |
| <td align="left" headers="r13c1-t7 r1c2-t7"> |
| <p>Merge and full override</p> |
| </td> |
| <td align="left" headers="r13c1-t7 r1c3-t7"> |
| <p>A sql-result-set-mapping is unique by name. sql-result-set-mapping defined in eclipselink-orm.xml overrides sql-result-set-mapping of the same name defined in other mapping files. Outside of the overriding case, an exception is thrown if two or more sql-result-set-mapping elements with the same name are defined in one or across multiple mapping files.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r14c1-t7" headers="r1c1-t7"> |
| <p><code>exclude-default-listeners</code></p> |
| </td> |
| <td align="left" headers="r14c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r14c1-t7 r1c3-t7"> |
| <p>If an exclude-default-listeners setting exists, then the eclipselink-orm.xml's exclude-default-listeners setting will be applied. If an exclude-default-listeners setting is not specified, it will not override an existing setting, that is essentially turning it off.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r15c1-t7" headers="r1c1-t7"> |
| <p><code>exclude-superclass-listeners</code></p> |
| </td> |
| <td align="left" headers="r15c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r15c1-t7 r1c3-t7"> |
| <p>If an exclude-superclass-listeners setting exists, then the eclipselink-orm.xml's exclude-superclass-listeners setting will be applied. If an exclude-superclass-listeners setting is not specified, it will not override an existing setting, that is essentially turning it off.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r16c1-t7" headers="r1c1-t7"> |
| <p><code>entity-listeners</code></p> |
| </td> |
| <td align="left" headers="r16c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r16c1-t7 r1c3-t7"> |
| <p>If an entity-listeners setting exists, then the eclipselink-orm.xml's entity-listeners setting will override and merge with an existing setting, or creates a new entity-listeners setting all together.</p> |
| <p><strong>Note</strong>: An entity listener override must be complete. All lifecycle methods of that listener must be specified and no merging of individual lifecycle methods of an entity listener is allowed. The class name of the listener is the key to identify the override.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r17c1-t7" headers="r1c1-t7"> |
| <p><code>pre-persist</code></p> |
| </td> |
| <td align="left" headers="r17c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r17c1-t7 r1c3-t7"> |
| <p>If a pre-persist setting exists, then the eclipselink-orm.xml's pre-persist setting overrides the existing setting, or creates a new pre-persist setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r18c1-t7" headers="r1c1-t7"> |
| <p><code>post-persist</code></p> |
| </td> |
| <td align="left" headers="r18c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r18c1-t7 r1c3-t7"> |
| <p>If a post-persist setting exists, then the eclipselink-orm.xml's post-persist setting overrides the existing setting, or creates a new post-persist setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r19c1-t7" headers="r1c1-t7"> |
| <p><code>pre-remove</code></p> |
| </td> |
| <td align="left" headers="r19c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r19c1-t7 r1c3-t7"> |
| <p>If a pre-remove setting exists, then the eclipselink-orm.xml's pre-remove setting overrides the existing setting, or creates a new pre-remove setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r20c1-t7" headers="r1c1-t7"> |
| <p><code>post-remove</code></p> |
| </td> |
| <td align="left" headers="r20c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r20c1-t7 r1c3-t7"> |
| <p>If a post-remove setting exists, then the eclipselink-orm.xml's post-remove setting overrides the existing setting, or creates a new post-remove setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r21c1-t7" headers="r1c1-t7"> |
| <p><code>pre-update</code></p> |
| </td> |
| <td align="left" headers="r21c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r21c1-t7 r1c3-t7"> |
| <p>If a pre-update setting exists, then the eclipselink-orm.xml's pre-update setting overrides the existing setting, or creates a new pre-update setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r22c1-t7" headers="r1c1-t7"> |
| <p><code>post-update</code></p> |
| </td> |
| <td align="left" headers="r22c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r22c1-t7 r1c3-t7"> |
| <p>f a post-update setting exists, then the eclipselink-orm.xml's post-update setting overrides the existing setting, or creates a new post-update setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r23c1-t7" headers="r1c1-t7"> |
| <p><code>post-load</code></p> |
| </td> |
| <td align="left" headers="r23c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r23c1-t7 r1c3-t7"> |
| <p>If a post-load setting exists, then the eclipselink-orm.xml's post-load setting overrides the existing setting, or creates a new post-load setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r24c1-t7" headers="r1c1-t7"> |
| <p><code>attributes</code></p> |
| </td> |
| <td align="left" headers="r24c1-t7 r1c2-t7"> |
| <p>Merge and mapping level override</p> |
| </td> |
| <td align="left" headers="r24c1-t7 r1c3-t7"> |
| <p>If the attribute settings (id, embedded-id, basic, version, many-to-one, one-to-many, one-to-one) exist at the mapping level, then the eclipselink-orm.xml's attributes merges or overrides the existing settings, else creates new attributes.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r25c1-t7" headers="r1c1-t7"> |
| <p><code>association-override</code></p> |
| </td> |
| <td align="left" headers="r25c1-t7 r1c2-t7"> |
| <p>Merge and mapping level override</p> |
| </td> |
| <td align="left" headers="r25c1-t7 r1c3-t7"> |
| <p>If an association-override setting exists, then the eclipselink-orm.xml's association-override setting overrides the existing setting, or creates a new association-override setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r26c1-t7" headers="r1c1-t7"> |
| <p><code>name</code></p> |
| </td> |
| <td align="left" headers="r26c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r26c1-t7 r1c3-t7"> |
| <p>If a name setting exists, then the eclipselink-orm.xml's name setting overrides the existing setting, or creates a new name setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r27c1-t7" headers="r1c1-t7"> |
| <p><code>class</code></p> |
| </td> |
| <td align="left" headers="r27c1-t7 r1c2-t7"> |
| <p>None</p> |
| </td> |
| <td align="left" headers="r27c1-t7 r1c3-t7"><br /></td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r28c1-t7" headers="r1c1-t7"> |
| <p><code>access</code></p> |
| </td> |
| <td align="left" headers="r28c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r28c1-t7 r1c3-t7"> |
| <p>If an access setting exists, then the eclipselink-orm.xml's access setting overrides the existing setting, or creates a new access setting. It also overrides the default class setting</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r29c1-t7" headers="r1c1-t7"> |
| <p><code>metadata-complete</code></p> |
| </td> |
| <td align="left" headers="r29c1-t7 r1c2-t7"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r29c1-t7 r1c3-t7"> |
| <p>If a metadata-complete setting exists, then the eclipselink-orm.xml's metadata-complete setting will be applied. If a metadata-complete setting is not specified, it will not override an existing setting, that is essentially turning it off.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| <br /></div> |
| <!-- class="tblhruleformalwide" --></div> |
| <!-- class="sect3" --> |
| <a id="BGBIJGGA" name="BGBIJGGA"></a><a id="TLJPA699" name="TLJPA699"></a> |
| <div class="sect3"><!-- infolevel="all" infotype="General" --> |
| <h4 class="sect3"><font face="arial, helvetica, sans-serif" color="#330099">Embeddable</font></h4> |
| <p>An embeddable can be defined wholly or may be defined so as to provide extensions to an embeddable from another mapping file. Therefore, we will allow the merging of that class' metadata. <a href="#BGBEDIBC">Table 6-4</a> lists the individual override rules Embeddable classes.</p> |
| <div class="tblhruleformalwide"><a id="TLJPA700" name="TLJPA700"></a><a id="sthref1250" name="sthref1250"></a><a id="sthref1251" name="sthref1251"></a> |
| <p><strong><em><font face="arial, helvetica, sans-serif">Table 6-5 Overriding and Merging Embeddable Classes</font></em></strong></p> |
| <table class="HRuleFormalWide" title="Overriding and Merging Embeddable Classes" summary="This table outlines overriding and merging embeddable classes. There are three columns: entity-mappings/embeddable, rule, and description." dir="ltr" border="1" width="100%" frame="hsides" rules="rows" cellpadding="3" cellspacing="0"> |
| <col width="21%" /> |
| <col width="23%" /> |
| <col width="*" /> |
| <thead> |
| <tr align="left" valign="top"> |
| <th align="left" valign="bottom" id="r1c1-t8"><font face="Arial, Helvetica, sans-serif"><strong>entity-mappings/ embeddable</strong></font></th> |
| <th align="left" valign="bottom" id="r1c2-t8"><font face="Arial, Helvetica, sans-serif"><strong>Rule</strong></font></th> |
| <th align="left" valign="bottom" id="r1c3-t8"><font face="Arial, Helvetica, sans-serif"><strong>Description</strong></font></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr align="left" valign="top"> |
| <td align="left" id="r2c1-t8" headers="r1c1-t8"> |
| <p><code>attributes</code></p> |
| </td> |
| <td align="left" headers="r2c1-t8 r1c2-t8"> |
| <p>Override and merge</p> |
| </td> |
| <td align="left" headers="r2c1-t8 r1c3-t8"> |
| <p>If the attribute settings (id, embedded-id, basic, version, many-to-one, one-to-many, one-to-one, many-to-many, embedded, transient) exist at the mapping level, then the eclipselink-orm.xml's attributes merges or overrides the existing settings, or creates new attributes.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r3c1-t8" headers="r1c1-t8"> |
| <p><code>class</code></p> |
| </td> |
| <td align="left" headers="r3c1-t8 r1c2-t8"> |
| <p>None</p> |
| </td> |
| <td align="left" headers="r3c1-t8 r1c3-t8"><br /></td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r4c1-t8" headers="r1c1-t8"> |
| <p><code>access</code></p> |
| </td> |
| <td align="left" headers="r4c1-t8 r1c2-t8"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r4c1-t8 r1c3-t8"> |
| <p>If an access setting exists, then the eclipselink-orm.xml's access setting overrides the existing setting, or creates a new access setting. It also overrides the default class setting.</p> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" id="r5c1-t8" headers="r1c1-t8"> |
| <p><code>metadata-complete</code></p> |
| </td> |
| <td align="left" headers="r5c1-t8 r1c2-t8"> |
| <p>Full override</p> |
| </td> |
| <td align="left" headers="r5c1-t8 r1c3-t8"> |
| <p>If a metadata-complete setting exists, then the eclipselink-orm.xml's metadata-complete setting will be applied. If a metadata-complete setting is not specified, it will not override an existing setting, that is essentially turning it off.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| <br /></div> |
| <!-- class="tblhruleformalwide" --></div> |
| <!-- class="sect3" --></div> |
| <!-- class="sect2" --> |
| <a id="BGBGFDDF" name="BGBGFDDF"></a><a id="TLJPA701" name="TLJPA701"></a> |
| <div class="sect2"><!-- infolevel="all" infotype="General" --> |
| <h3 class="sect2"><font face="arial, helvetica, sans-serif" color="#330099">Examples of Overriding and Merging</font></h3> |
| <div class="example"><a id="TLJPA702" name="TLJPA702"></a><a id="sthref1252" name="sthref1252"></a> |
| <p><strong><em><font face="arial, helvetica, sans-serif">Example 6-1 Overriding/Merging Example 1</font></em></strong></p> |
| <p>In this example, your EclipseLink project contains:</p> |
| <ul> |
| <li> |
| <p><code>META-INF/orm.xml</code> – Defines Entity <strong>A</strong> with the mappings <strong>b</strong> and <strong>c</strong></p> |
| </li> |
| <li> |
| <p><code>META-INF/eclipselink-orm.xml</code> – Defines Entity <strong>A</strong> with the mappings <strong>c</strong> and <strong>d</strong></p> |
| </li> |
| </ul> |
| <p>Results in:</p> |
| <ul> |
| <li> |
| <p>Entity <strong>A</strong> containing:</p> |
| <ul> |
| <li> |
| <p>mapping <strong>b</strong> (from <code>orm.xml</code>)</p> |
| </li> |
| <li> |
| <p>mappings <strong>c</strong> and <strong>d</strong> (from <code>eclipselink-orm.xml</code>)</p> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <!-- class="example" --> |
| <div class="example"><a id="TLJPA703" name="TLJPA703"></a><a id="sthref1253" name="sthref1253"></a> |
| <p><strong><em><font face="arial, helvetica, sans-serif">Example 6-2 Overriding/Merging Example 2</font></em></strong></p> |
| <p>In this example, your EclipseLink project contains:</p> |
| <ul> |
| <li> |
| <p><code>META-INF/orm.xml</code> – Defines Entity <strong>A</strong> with mappings <strong>b</strong> and <strong>c</strong></p> |
| </li> |
| <li> |
| <p><code>META-INF/some-other-mapping-file.xml</code> – Defines Entity <strong>B</strong> with mappings <strong>a</strong> and <strong>b</strong></p> |
| </li> |
| <li> |
| <p><code>META-INF/eclipselink-orm.xml</code> – Defines Entity <strong>A</strong> with the mappings <strong>c</strong> and <strong>d</strong>, and Entity <strong>B</strong> with mapping <strong>b</strong> and <strong>c</strong></p> |
| </li> |
| </ul> |
| <p>Results in:</p> |
| <ul> |
| <li> |
| <p>Entity A containing:</p> |
| <ul> |
| <li> |
| <p>mapping <strong>b</strong> (from <code>orm.xml</code>)</p> |
| </li> |
| <li> |
| <p>mappings <strong>c</strong> and <strong>d</strong> (from <code>eclipselink-orm.xml</code>)</p> |
| </li> |
| </ul> |
| </li> |
| <li> |
| <p>Entity B containing:</p> |
| <ul> |
| <li> |
| <p>mapping <strong>a</strong> (from <code>some-other-mapping-file</code>)</p> |
| </li> |
| <li> |
| <p>mappings <strong>b</strong> and <strong>c</strong> (from <code>eclipselink-orm.xml</code>)</p> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <!-- class="example" --> |
| <div class="example"><a id="TLJPA704" name="TLJPA704"></a><a id="sthref1254" name="sthref1254"></a> |
| <p><strong><em><font face="arial, helvetica, sans-serif">Example 6-3 Overriding/Merging Example 3</font></em></strong></p> |
| <p>In this example, your EclipseLink project contains:</p> |
| <ul> |
| <li> |
| <p><code>META-INF/orm.xml</code> – Defines Entity <strong>A</strong> with mappings <strong>b</strong> and <strong>c</strong>.</p> |
| </li> |
| <li> |
| <p><code>META-INF/eclipselink-orm.xml</code> – Defines Entity <strong>A</strong> with mappings <strong>c</strong> and <strong>d</strong>.</p> |
| </li> |
| <li> |
| <p><code>META-INF/some-other-mapping-file.xml</code> – Defines Entity <strong>A</strong> with mapping <strong>x</strong>.</p> |
| </li> |
| </ul> |
| <p>Results in:</p> |
| <ul> |
| <li> |
| <p>Entity <strong>A</strong> containing:</p> |
| <ul> |
| <li> |
| <p>mapping <strong>b</strong> (from <code>orm.xml</code>)</p> |
| </li> |
| <li> |
| <p>mappings <strong>c</strong> and <strong>d</strong> (from <code>eclipselink-orm.xml</code>)</p> |
| </li> |
| <li> |
| <p>mapping <strong>x</strong> (from <code>some-other-mapping-file.xml</code>)</p> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <!-- class="example" --> |
| <div class="example"><a id="TLJPA705" name="TLJPA705"></a><a id="sthref1255" name="sthref1255"></a> |
| <p><strong><em><font face="arial, helvetica, sans-serif">Example 6-4 Overriding/Merging Example 4</font></em></strong></p> |
| <p>In this example, your EclipseLink project contains:</p> |
| <ul> |
| <li> |
| <p><code>META-INF/orm.xml</code> – Defines Entity <strong>A</strong> with mappings <strong>b</strong> and <strong>c</strong>.</p> |
| </li> |
| <li> |
| <p><code>META-INF/extensions/eclipselink-orm.xml</code> – Defines defines Entity <strong>A</strong> with mappings <strong>c</strong> and <strong>d</strong>.</p> |
| <p>Note: The file is added through a <code><mapping-file></code> tag in the <code>persistence.xml</code> file.</p> |
| </li> |
| </ul> |
| <p>Results in an exception, due to conflicting specifications for mapping <strong>c</strong>.</p> |
| </div> |
| <!-- class="example" --> |
| <div class="example"><a id="TLJPA706" name="TLJPA706"></a><a id="sthref1256" name="sthref1256"></a> |
| <p><strong><em><font face="arial, helvetica, sans-serif">Example 6-5 Overriding/Merging Example 5</font></em></strong></p> |
| <p>In this example, your EclipseLink project contains:</p> |
| <ul> |
| <li> |
| <p><code>META-INF/orm.xml</code> – Defines Entity <strong>A</strong> with mappings <strong>b</strong> and <strong>c</strong></p> |
| </li> |
| <li> |
| <p><code>META-INF/jpa-mapping-file.xml</code> – Defines Entity <strong>A</strong> with mappings <strong>a</strong> and <strong>d</strong></p> |
| </li> |
| <li> |
| <p><code>META-INF/extensions/eclipse-mapping-file.xml</code> – Defines defines Entity <strong>A</strong> with mappings <strong>c</strong> and <strong>d</strong></p> |
| </li> |
| </ul> |
| <p>Results in an exception, due to conflicting specifications for mapping <strong>c</strong> or <strong>d</strong> (which ever is processed first).</p> |
| </div> |
| <!-- class="example" --></div> |
| <!-- class="sect2" --></div> |
| <!-- class="sect1" --></div> |
| <!-- class="ind" --> |
| <!-- Start Footer --> |
| <div class="footer"> |
| <hr /> |
| <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> |
| <col width="33%" /> |
| <col width="*" /> |
| <col width="33%" /> |
| <tr> |
| <td valign="bottom"> |
| <table class="navigation simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100" align="center"> |
| <col width="*" /> |
| <col width="48%" /> |
| <col width="48%" /> |
| <tr> |
| <td> </td> |
| <td align="center"><a href="persistenceproperties_ref.htm"><img src="../../../dcommon/images/larrow.png" alt="Previous" border="0" height="16" width="16" /></a></td> |
| </tr> |
| </table> |
| </td> |
| <td align="center" width="34%"><a href="http://www.eclipse.org/eclipselink/" title="EclipseLink home"><img src="../../../dcommon/images/ellogo.png" alt="EclipseLink" width="150" border="0" /></a><br /> |
| </td> |
| |
| <td valign="bottom" align="right"> |
| <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="225"> |
| <tr> |
| <td> </td> |
| <td align="center" valign="top"><a href="toc.htm"><img src="../../../dcommon/images/contents.png" alt="Go To Table Of Contents" border="0" height="16" width="16" /><br /> |
| </td><td> </td><td align="center"><a href="../../../" target="_top" class="external text" title="Search" rel="nofollow"><img src="../../../dcommon/images/search.png" alt="Search" style="border:0;" /><br /><span class="mini"></span></a></td><td> </td><td align="center"><a href="../../eclipselink_jpa_extensions.pdf" title="PDF" target="_blank"><img src="../../../dcommon/images/pdf_icon.png" style="padding-right:5px;border:0" alt="PDF"></a></td><td align="center"><a href="#disqus_thread" title="Comments""><img src="../../../dcommon/images/comments.png" style="padding-right:5px;border:0" alt="Comments"><br /><span class="mini">Comments</span></a> |
| </tr> |
| </table> |
| </td> |
| </tr> |
| </table> |
| </div> |
| <!-- class="footer" --> |
| <div id="copyright">Copyright © 2014 by The Eclipse Foundation under the <a href="http://www.eclipse.org/org/documents/epl-v10.php">Eclipse Public License (EPL)</a><br /> <script type="text/javascript">var LastUpdated = document.lastModified;document.writeln ("Updated: " + LastUpdated);</script> </div><!-- START: Analytics --><script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1608008-2']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script><!-- END: Analytics --><!-- START: Sharethis --><script>var options={ "publisher": "e2fe9e07-fab6-4f84-83ea-0991b429842c", "position": "right", "ad": { "visible": false, "openDelay": 5, "closeDelay": 0}};var st_hover_widget = new sharethis.widgets.hoverbuttons(options);</script><!-- END: Sharethis --></body> |
| </html> |