• 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

How to read from XSD generated database and put that data into XML file.

 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello.

I am creating a batch tool that must read data from a database, and put this data in a XML file, which is the application output.
Goal: the XML file contents must be a representation of the data contained in the database.

Starting point is a XSD file I have, which acts as a schema definition for both the database and XML file. First, I generated the database tables using a tool called XSD2DB which generates database tables based on the XSD.
Next, I have used JAXB xjc to generate Java classes based on the XSD.

Another process inserts the relevant data in the database.

Up until now I have instantiated one or two of the generated classes, read some data from the 'reflecting/accompanying' tables in my database, and I finally marshalled the objects to a XML file.
Since the XSD (and the database and XML file for that matter) is pretty large, I wonder if there is any way the database contents can be put in the XML, without having to populate my java objects explicitly. Lazy as I am, I'd like to use some sort of tool that automatically copies the database data to the XML file. While writing this, I am thinking of using Hibernate (JPA) and then JAXB marshalling as a two-step process.

Alternatives, ideas or insights are much appreciated.
Thanks!
 
LOOK! OVER THERE! (yoink) your tiny ad is now my tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic