• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JAXB objects to Transfer objects

 
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In our project we have several services (ejb's) which can be invoked using XML. The story is like this:

[external client]--xml--[jaxb]--jaxb objects--[converter]---domain objects---[service]

[internal client]--domain objects---[service]

Thus, every service has its own domain objects. These objects are simple java beans (get/set) which describe the input fields to execute the service. We need this layer of independence because the service can also be called from inside.

So, the classes that jaxb generates to convert the XML to java need to be converter again to the domain objects. So the converter does basicly this:

domainObject.setName(jaxbObject.getName());
domainObject.setStreet(jaxbObject.getStreet());
etc...

For simple examples this may not seem a problem, but for comlex XML it becomes very error phrone to write such converter. It takes a long time to write it, test cases take even longer...

I feel like this conversion must be done automatically. Something like saying to JAXB to use our domain objects and not te generated ones...

Any one an idea ?
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why do you need both at all?
 
reply
    Bookmark Topic Watch Topic
  • New Topic