• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to convert java object into xml .Object contains contains cyclic references

 
santro
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

how to convert hibernate3 java objects into xml(marshalling)

please help me.

Thanks in Advance,
Santa rao
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a Hibernate question. I'll move this to our "Object Relational Mapping" forum.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your mapping you will include what each class and attribute will map to which tags and attributes of the XML. Then when you create/open a Session, you set the EntityMode to EntityMode.DOM4J by calling

Session dom4jSession = session.getSession(EntityMode.DOM4J)

So example mapping.



Notice that node's that have an "@" in it means it is an attribute of the xml tag before it, so @id is an attribute or the order tag

so

<order id=123/>
<orderNbr>500123</orderNbr>
<lineItems>
<whatever tags and attributes you define in the LineItems mapping file>
<whatever tags and attributes you define in the LineItems mapping file>
<whatever tags and attributes you define in the LineItems mapping file>
<This is looped for how many lineItems are in the Set Collection>
</lineItems>


Hope that helps.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic