views:

55

answers:

1

So my web application is primarily using XML for client to server interaction and I'm currently persisting most of my backend using hibernate. I know there are XML databases and there that you can save XML using hibernate by invoking Sessions with the DOM4J entity but I'm not sure what the most efficient way of serving up the XML really is. At the moment each time an object is request I generate an XML document from the object fields then serve it up. So for each new request I generate a whole new XML document. So I could generate the XML for each document during each runtime cycle the first time it is requested then store it in a field for the object so I can then run XSLT command against it but this seems kind of inefficient. I'm guessing its more efficient to generate a new Document object each time the resource is request and then drop it after the request has been served(and use Hibernate Query Language for selection)... Or should I persist xml using Hibernate or eXist?(I really don't want to use an xml database!)

A: 

You can store the XML as a CLOB or BLOB in the database. If you don't need to look inside the document when you query, you can just externalize the key fields and query for the XML based on those.

duffymo