• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Converting a Java Class to XML when Class contains Non-Primitive Types

 
Greenhorn
Posts: 5
Hibernate Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I want to convert a class to XML, and that class contains a non primitive type, what do I do? In my case, I want to convert class Employee to XML, but it contains a non-primitive type (Department) that is another table. My simple example of this appears below.



The XML I want displayed is the following (I'm building a RESTful interface):



I'm using Spring, so it would be especially helpful if you could tell me how to do this using one of the marshallers they make available (JAXB, Castor, XMLBeans, JiBX, or XStream).
 
it's a teeny, tiny, wafer thin ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic