• 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 ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

populating Jaxb JavaBeans

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


 
permaculture is a more symbiotic relationship with nature so I can be even lazier. Read tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic