File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes populating Jaxb JavaBeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "populating Jaxb JavaBeans" Watch "populating Jaxb JavaBeans" New topic
Author

populating Jaxb JavaBeans

Neha k Agrawal
Greenhorn

Joined: Mar 25, 2008
Posts: 25
Hi all,
I need solution to one of the problem that we are facing. I have a set of XSDs and I have generated Java Beans for those XSDs using Jaxb. Now I need to query the database[different query for every XSD] and populate these java beans using Resultset.

THis task is very simple if I want to harcode everything. In that case I need to know which query is for which XSD and populate the java beans by calling the setter for every fields in the Java Bean.

But I want to write a generic method , which just take the cachedRowset and Java Bean instance and start populating without any hard coding.

I got to know about Apache's BeanUtils.populate() method but I think it is good only for simple Java Beans[no hierarchy] not for the complex one where all the fields are not at the same level. Like the one generated from JAXB.


Can anyone please tell me what approach I should use to write a generic method?Any help would be highly appreciated.

Thanks in advance.


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: populating Jaxb JavaBeans
 
Similar Threads
JAXB objects to Transfer objects
Match XML data value with the mysql database
Java objects to XML, possibly using JAXB
How to add JAXB customization to a particular element of an xsd?
Error while parsing schema