Mapping setup:
1. A class containing a list. Mapped as non-cumulative and having remove-orphans=true. Elements of the list should be complex objects (a user-defined class).
2. The same structure of classes on the target side of mapping.
3. Mapping is done onto an existing instance of target class.
Problem:
Some objects of the web of objects lose some information.
This is caused by two mappings being done in non-cumulative mode: one to a class, then the second one onto an object. During the first mapping a wrong result is cached and then used.
I attach some minimal set of classes which illustrates the problem.
If something is unclear please ask.
Bug example
I have investigated this issue. Thank you for the test case.
In my opinion this is caused due to the fact that recursive non-cumulative mapping is just not implemented at all. Meaning that Dozer will update all fields of collection elements, but not the attribute fields. Everything below one level of depth will be overwritten.
It could be a nice feature request. I will state in documentation that it is not provided yet and we might implement recursive object update in the future. Lets keep this issue open for now.
This was reported a long time ago, but it is causing us a problem now. It looks to me like this could be solved by saving the state of the cache and restoring it when the code detects that the object already exists in a non-cumulative collection just before the mapping is repeated targeting the existing collection member.
I'm going to try this. If it work, I'll post a patch.