I need to send the changed data from the database (one server to another) and since i am not sure which table -> Bean is gona change, I have decided to send the changed in the format of XML generated at run time
For the generation of this XML i thought to create it via REFLECTION i.e; using reflection i'll get the class name (which will be table-name) and then field name (which will be column-name).
The XML generation class will have a method like
This ParentBean class will be the parent of all bean classes mapped on tables. I am doing this so that i may pass *ANY* class object to the generateXML method and it'll generate XML.
Now i have 2 questions.
1: Is my approach right? or there is any other good way to generate DYNAMIC XML for ANY CLASS at runtime. The xml should have it's column names as CLASS fields etc ...
2: How can i get field names of my child class which is being referenced by parentBean - using reflection.
The difference between <b>failure</b> and <b>success</b> is often being <b>right</b> and being <b>exactly right</b>.
Castor is an Open Source data binding framework for Java[tm]. It's the shortest path between Java objects, XML documents and relational tables. Castor provides Java-to-XML binding, Java-to-SQL persistence, and more.
[ June 27, 2008: Message edited by: Jesper Young ]