Multiple configurations issue

293 views
Skip to first unread message

Juraj Misur

unread,
Oct 24, 2013, 10:30:50 AM10/24/13
to dozer-...@googlegroups.com
Hi, 

I found similar issue on github (https://github.com/DozerMapper/dozer/pull/28) but this is probably better place to ask. It relates to 

Caused by: org.dozer.MappingException: More than one global configuration found.

I have similar need to use multiple configuration tags in mapping xml due to the nature of multi-module project, where submodules would inherit global configuration but would like to define some custom-converters itself.

My case is that I would like to automatically convert ids to domain entities (String personId <-> Person person) and vice-versa. This works well with custom converter based on Entity<->String type mapping defined in configuration block. Together with @Mapping("personId") on private Person person; field on domain entity, it yields really convenient way to auto-convert id to domain class.

However because we also have mapping configuration in other modules which does not include domain dependencies (EntityManager etc), we're unable to reuse this configuration and enhance it with module-specific.

I know there is a workaround by using custom-converter on every such field, but it's not quite practical to do such thing on literally hundreds of fields.

So, my questions are:
1) Is there any convenient way to do this right now? As I said custom-converter on every field is unusable.

2) Is there possibility that dozer will support configuration merge (e.g. if I supply pull request), so that it does not enforce somebody's ideas about application design, but empowers user to do whatever he likes (the same way spring allows bean overriding... )?

Thanks a lot,
Juraj
Reply all
Reply to author
Forward
0 new messages