M
mikko.tanskanen
Hi,
Is it possible to read the whole database structure to XML file with
JDOM? At the moment I'm getting the structure like this:
List<Classes> classes = session.createQuery("from Classes").list();
Element root = new Element("db");
Document doc = new Document(root);
for ( int i = 0; i < classes().size(); i++ ) {
Element classes = new Element("class");
Long id = new Long(classes().get(i).getId());
classes.setAttribute("id", Integer.toString(id.intValue()) );
Element name = new Element("name");
name.setText(classes().get(i).getName());
classes.addContent(name);
root.addContent(classes);
}
I have very complex database with lots of tables and columns, so it
would be frustrating to write every element name manually. So is there
a possibility that I could get all the element names like "class",
"id", "name" using JDOM? That would help a lot. If you have another way
to do this without using JDOM, I would be happy to hear it.
Is it possible to read the whole database structure to XML file with
JDOM? At the moment I'm getting the structure like this:
List<Classes> classes = session.createQuery("from Classes").list();
Element root = new Element("db");
Document doc = new Document(root);
for ( int i = 0; i < classes().size(); i++ ) {
Element classes = new Element("class");
Long id = new Long(classes().get(i).getId());
classes.setAttribute("id", Integer.toString(id.intValue()) );
Element name = new Element("name");
name.setText(classes().get(i).getName());
classes.addContent(name);
root.addContent(classes);
}
I have very complex database with lots of tables and columns, so it
would be frustrating to write every element name manually. So is there
a possibility that I could get all the element names like "class",
"id", "name" using JDOM? That would help a lot. If you have another way
to do this without using JDOM, I would be happy to hear it.