camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bwtaylor <>
Subject Re: Strategy to map/transform a POJO into a POJO
Date Thu, 12 Jun 2008 22:15:41 GMT

I think this is a somewhat hard problem. I've worked with such assemblers,
and they are annoyingly finicky. I'm continually amazed that good solutions
to the object graph assembly question aren't readily available.

We've used Dozer for our project related to GWT to prepare our object graphs
for serialization via GWT-RPC. I have to say it's the best toolkit out there
right now, BUT I'm really not very happy with it. It has some strange
behaviors regarding it's hint system that are probably bugs. It sometimes
freaks out with inheritance chains, and I've seen it behave in
non-deterministic ways because it iterates over hash sets. For a complicated
object graph, we end up writing a whole lot of configuration for dozer.
Debugging dozer is a real pain in the butt, because of it's recursive style
algorithms. Perhaps as it gets more use and matures it will get better. I've
wasted many hours wrestling with it.

I've changed my thinking and wouldn't use it again, at least not right now.
When your object graphs are deep, or you've got non-trivial things going on
(like hibernate proxies and PersistentCollections for lazy loading) I think
you'll find you have to design the solution use case by use case anyway, to
do things like clip the object graph appropriately. I'm not convinced you
really will end up with better than regular java code. Usually such code is
very simple and it will be much faster than runtime reflection assemblers
like Dozer. 

I'm playing with ways to generate the building blocks for this directly. Two
approaches come to mind: using a template system with compile time
reflection or building up an expression language script using something like
MVEL or OGNL. I've just been working on a freemarker based approach that
leverages hibernate-tools to generate copier objects for entities in my
object model.

cmoulliard wrote:
> Hi,
> What is the best strategy to map/transform a POJO object into another one
> through Camel ? The idea is to map a POJO into a POJO domain which is more
> representative of the domain that next we have to commit it into the DB
> through Hibernate.
> Is Dozer an interesting tool ?
> Charles

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message