You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tom Ziemer <t....@dkfz-heidelberg.de> on 2007/02/20 13:46:10 UTC

[OT] Complex domain objects and web services

Hi everybody,

I am aware that this is totally OT, but I'd be really grateful for any
answers, hints, best practices, links, whatever. My problem is as
follows:

I am using Hibernate/Spring to load domain objects (DOM) from my
database, then I use these DOMs to display information on the web.
Great. Now I want to add web services and all of a sudden this won't
really work anymore. What I'd like to do is use JAXB2 to marshall my
DOMs, transfer them using XFire and reasemble them via JAXB2 on the
client side. For simple objects this works nicely yet when you have
cyclic dependencies (parent: private List<Abc> children / each child:
private Abc parent), JAXB cannot handle this. I've experimented with
afterUnmarshal() from the JAXB API and also with onCycleDetected() from
JAXB RI 2.1, yet both approaches do not really appeal to me.

Do I need to introduce an DTO layer, that does not have these cyclic
dependencies or is there a cleaner, more elegant approach to solve this?
As I already stated, I'd be really greatful for your input.

Regards,
Tom