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 4112244
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:10:13+00:00 2026-05-20T22:10:13+00:00

I have a set of a beans in a separate project that I’m unable

  • 0

I have a set of a beans in a separate project that I’m unable to alter. These beans have both JPA and JAXB annotations, and are being used in a RESTful implementation. Most of my relationships are lazy-loaded, and I was hoping to achieve some more granular control over which elements are actually marshalled for transport.

I’ve got the modified MOXy Customer.java class below.

@javax.xml.bind.annotation.XmlType
@javax.xml.bind.annotation.XmlAccessorType(value=javax.xml.bind.annotation.XmlAccessType.PROPERTY)
public class Customer {

  private String name;
  private Address address;
  private List<PhoneNumber> phoneNumbers;

  // getters and setters
}

I was hoping I’d be able to use the MOXy eclipselink-oxm mapping to control what gets marshalled, but it isn’t behaving as I’d expect. Using JAXB annotations, you declare an element (field or property) to be transient, but the eclipselink-oxm.xml only allows transient declarations on types. However, when I declare a type transient like so, I get the following exceptions:

<?xml version="1.0"?>
<xml-bindings 
    xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm">
<java-types>
    <java-type name="example.gettingstarted.Customer">
        <xml-root-element/>
        <java-attributes>
            <xml-element java-attribute="name" xml-path="personal-info/name/text()"/>
            <xml-element java-attribute="address" xml-path="contact-info/address"/>
        </java-attributes>
    </java-type>

    <java-type name="example.gettingstarted.PhoneNumber" xml-transient="true" />

</java-types>
</xml-bindings>

Exception:

Exception [EclipseLink-110] (Eclipse Persistence Services - 2.1.0.v20100614-r7608):     org.eclipse.persistence.exceptions.DescriptorException
Exception Description: Descriptor is missing for class [example.gettingstarted.PhoneNumber].
Mapping: org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping[phoneNumbers]
Descriptor: XMLDescriptor(example.gettingstarted.Customer --> [DatabaseTable(customer)])

If I remove the xml-transient attribute, or set it to false, the Customer is transformed into XML as expected. Is there any way I can suppress the marshalling of phone numbers without modifying the Customer bean?

  • 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-20T22:10:14+00:00Added an answer on May 20, 2026 at 10:10 pm

    You can specify use the following mapping file to make the “phoneNumbers” property on Customer transient:

    <?xml version="1.0"?>
    <xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm">
        <java-types>
            <java-type name="example.gettingstarted.Customer">
                <xml-root-element />
                <java-attributes>
                    <xml-element java-attribute="name" xml-path="personal-info/name/text()" />
                    <xml-element java-attribute="address" xml-path="contact-info/address" />
                    <xml-transient java-attribute="phoneNumbers"/>
                </java-attributes>
            </java-type>
        </java-types>
    </xml-bindings>
    

    For more information on MOXy’s XML mapping file see:

    • http://bdoughan.blogspot.com/2010/12/extending-jaxb-representing-annotations.html
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a set of beans that are characterized by two properties. They are
In my current project we have a set of service classes that are secured
I have set the eclipse java formatter to wrap lines that exceed 120 characters
I have set up an app that is registered for remote notifications. - (void)application:(UIApplication*)application
I have two CFC's which are Beans with DAO functions. I have set up
I want to have a Java facelet that has EL expressions, and a set
You might have a set of properties that is used on the developer machine,
I have a set of Spring beans created using constructor injection. Since there are
Is it possible to set properties to beans when they are auto-detected? I have
I have set a background on the data-role=page element like so <div data-role=page style=background:

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.