Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Overriding orm.xml with eclipselink-orm.xml?
icon5.gif  Overriding orm.xml with eclipselink-orm.xml? [message #1720280] Fri, 15 January 2016 21:03
Laird Nelson is currently offline Laird NelsonFriend
Messages: 1
Registered: July 2009
Junior Member
The page documenting the eclipselink-orm.xml file says, in part:

Quote:
This mapping file can be used in place of JPA's standard mapping file or can be used to override a JPA mapping file.


I'm interested in doing the latter, not the former.

Accordingly, I put the following in my META-INF/persistence.xml file:
<mapping-file>META-INF/my-orm.xml</mapping-file>
<mapping-file>META-INF/my-eclipselink-orm.xml</mapping-file>

They are picked up just fine.

Now, note that I do not want the contents of my-eclipselink-orm.xml to be a superset of the contents of my-orm.xml. I just want to put the bare minimum of XML necessary in it to (semantically) add certain EclipseLink-specific features to a given mapping specified in my-orm.xml.

So now suppose I have a <one-to-many> mapping in my-orm.xml named names. (Basic, basic stuff.)

Suppose now in my-eclipselink-orm.xml I'd like to semantically add the <batch-fetch> element to that mapping.

If I do this:

<entity class="the.entity.class.in.Question">
  <attributes>
    <one-to-many name="names">
      <batch-fetch size="10" type="JOIN"/>
    </one-to-many>
  </attributes>
</entity>

...then EclipseLink yells at me:

Conflicting XML elements [<one-to-many>] with the same name [names] were found. The first was found in the mapping file [file:/Users/ljnelson/Projects/foo/target/classes/META-INF/my-eclipselink-orm.xml] and the second in the mapping file [file:/Users/ljnelson/Projects/foo/target/classes/META-INF/my-real-orm.xml]. Named XML elements must be unique across the persistence unit.

So how do I override only certain parts of a "real" orm.xml with an eclipselink-orm.xml?

Thanks in advance!
Previous Topic:IdentityHashMap gets NPE when trying to put
Next Topic:EclipseLink read performance issue with MongoDB
Goto Forum:
  


Current Time: Thu Mar 28 12:31:32 GMT 2024

Powered by FUDForum. Page generated in 0.02964 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top