Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Nested Object initialization
Nested Object initialization [message #1711979] Tue, 20 October 2015 14:08
Antonio Cirasole is currently offline Antonio CirasoleFriend
Messages: 1
Registered: October 2015
Junior Member

I'm using EclipseLink Moxy for my OXM mappings.

My main domain objects are something like this:

public class BuyOrder {

  private Integer id;
  private String odaNumber;
  private String company;

  private Organization expediter1;
  private Organization expediter2;

  private List<BuyOrderItem> orderItems;

public class Organization {

  private Integer id;
  // XML tag -> Code
  private String sapCode;
  // XML tag -> Description
  private String companyName;


And my eclipselink-oxm.xml is as follow:

<?xml version="1.0" encoding="US-ASCII"?>
<xml-bindings xmlns="" package-name="it.mysigl.datamodel"

        <java-type name="BuyOrder">
            <xml-root-element name="Header"/>

                <xml-element java-attribute="odaNumber" name="oda_number"/>
                <xml-element java-attribute="company" name="company"/>

                <xml-element java-attribute="orderItems" name="Item"/>
        <java-type name="BuyOrderItem">
                <xml-element java-attribute="odaPos" name="oda_pos"/>
                <xml-element java-attribute="division"/>
        <java-type name="it.mysigl.datamodel.Organization">
                <xml-element java-attribute="companyName" name="oda_pos"/>
                <xml-element java-attribute="sapCode" name="expediter1_code"/>

The XML I'd need to unmarshal is like this:

<?xml version="1.0" encoding="UTF-8"?>
		<company>NA1 </company>

		<expediter1_description>MYCOMPANY S.P.A.            </expediter1_description>
		<expediter2_description>NAMIBIA PTY                 </expediter2_description>



Would it be possible to unmarshal:

- expediter1_code
- expediter1_description

into BuyOrder.expediter1


- expediter2_code
- expediter2_description

into BuyOrder.expediter2?
If yes, how? Will an adapter work for this?


[Updated on: Tue, 20 October 2015 17:07]

Report message to a moderator

Previous Topic:Wrong SQL using COALESCE
Next Topic:MOXy Schema generation of xsd:restictions
Goto Forum:

Current Time: Wed Feb 21 03:10:54 GMT 2024

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

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

Back to the top