Working with XML data
30 August 2008Hibernate allows us to work with persistent XML data same as POJOs. A parsed XML tree is actually a representation of relational data at the object level, instead of POJOs.
Hibernate uses dom4j API for manipulating XML trees. We can write queries that retrieve dom4j trees from the database and then all modifications to the tree automatically are synchronized to the database.
One can take an XML document, parse it using dom4j, and write it to the database with any of Hibernate’s basic operations: persist(), saveOrUpdate(), merge(), delete(), replicate().
There are many applications of this feature like data import/export, externalization of entity data via JMS or SOAP and XSLT-based reporting. A single mapping can be used to map properties of a class and nodes of an XML document to the database. But if there is no class to map, it will be used to map just the XML.
Related Posts:
Top Of Page | Trackback
If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.
It will look like this: Working with XML data