Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6363219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:00:38+00:00 2026-05-25T00:00:38+00:00

I have entities which are created from eclipseLink.I am trying to use the same

  • 0

I have entities which are created from eclipseLink.I am trying to use the same objects to get generate an xml.I have a primarykey reference inside a class and I am not sure what annotation I need to use to get the desired xml.
I have

public class ABC implements Serializable {
private static final long serialVersionUID = 1L;

@EmbeddedId
private NamePK id;

@XmlElement
private String address1;

    @XmlElement
private String address1;

…
}

 public class NamePK implements Serializable {
//default serial version id, required for serializable classes.
private static final long serialVersionUID = 1L;

@Column(name="county")
@XmlTransient
private String county;

@Column(name="NAME")
@XmlElement
private String name;

….

}

How should the annotation at the NamePk be for me to get the xml output as

 <name>XXX</name>
 <Address1>YYY</Address1>
 <Address2>ZZZ</Address2>

Do I need annotate at both the levels of the PK?(Class Level and reference)

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:00:38+00:00Added an answer on May 25, 2026 at 12:00 am

    Note: I’m the EclipseLink JAXB (MOXy) lead, and a member of the JAXB 2 (JSR-222) expert group.

    You can use the MOXy JAXB implementation in EclipseLink to accomplish this:

    ABC

    You can use @XmlPath(".") to have the embedded ID marshal/unmarshal at the same level as your ABC class:

    public class ABC implements Serializable {
    
        private static final long serialVersionUID = 1L;
    
        @EmbeddedId
        @XmlPath(".")
        private NamePK id;
    
        @XmlElement
        private String address1;
    
        @XmlElement
        private String address1;
    
    }
    

    For More Information

    • http://wiki.eclipse.org/EclipseLink/UserGuide/MOXy
    • http://blog.bdoughan.com/2010/07/xpath-based-mapping.html
    • http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as-your.html
    • http://blog.bdoughan.com/2010/07/jpa-entities-to-xml-bidirectional.html
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have this app which needs to query entities from the Azure Tables
I have two entities, Customer and Order, both of which I have created types
I have an entity called Medico which was created as an Entity Class from
i am new to solr. I have created two separate entities which are not
I have several entities which respresent different types of users who need to be
I've got some entities which have decimal properties on them. These entities' properties are
We have bunch of Domain Entities which should be rendered to an html format,
I have Entity Framework entities Events which have an EntityCollection of RSVP. I want
I have two entities say Customer and Order which exist on their own and
I have a class which provides generic access to LINQ to SQL entities, for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.