• 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 ...
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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

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.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic