I need to read every row of a particular table stored in a mysql DB, then i have to write an xml file extracted from each row. Which is the best practice for obtaining this target? I should use some java libraries, but i don't know how to choose the exact ones.
1 Answer
look at this:
http://examples.javacodegeeks.com/core-java/xml/bind/jaxb-marshal-example/
From the DB if you use an ORM like hibernate or other you will get your rows as objects and then you can transforme them using JAXB.
3 Comments
jMounir
you have many possibilities, either create a JPA entities that describe your DB or use a hibernate ResultTransformer look at this issue stackoverflow.com/questions/3266492/…
FDC
Thank you jMounir, so now i install hibernate and with ResultTransformer I turn my row in objects, and then i have to marshall this objects in xml file. Is it right?
jMounir
Yes, that's right. if you mean by "install hibernate" that you're going to configurate it (add depndency and create persistence.xml file)