Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Multiple mappings for a single xml element
Multiple mappings for a single xml element [message #1297801] Tue, 15 April 2014 22:58
Mar Sah is currently offline Mar SahFriend
Messages: 2
Registered: April 2014
Junior Member
The Eclipse Link moxy documentation describes how to have multiple mappings for a single property. Instead I need to have a single xml element map to multiple java attributes. Is this possible? Unfortunately I have no control over the class hierarchy or the xml schema.

Here is an example of the xml:


The Java classes would look like this.

public class Order {
PayIdentity payer;
String orderId;
String customerId;
String groupId;
long quantity;

public class Payer {
String customerId;
String groupId;

Excerpt from mappings file:

<java-type name="Order" xml-accessor-type="NONE" >

<xml-element java-attribute="payer" xml-path="."
type="PayIdentity" />

<xml-element java-attribute="orderId" name="Id" />
<xml-element java-attribute="customerId" name="CustomerId" />
<xml-element java-attribute="groupId" name="GroupId" />
<xml-element java-attribute="quantity" name="Quantity" />


<java-type name="PayIdentity" xml-accessor-type="NONE" >

<xml-element java-attribute="customerId" name="CustomerId" />
<xml-element java-attribute="groupId" name="GroupId" />


The problem is that the inclusion of the payer mapping causes the customerId and groupId attributes in the Order class to be null.
Previous Topic:Invoke JPA entity creation process from a script
Next Topic:Custom PoolDataSource - How to change in EclipseLink
Goto Forum:

Current Time: Mon Jun 25 19:59:18 GMT 2018

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

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

Back to the top