Fork me on GitHub

One-Way Mapping

You can set how a mapping definition behaves as far as direction goes. If you only want to map two classes to go one-way you can set this at the mapping level. The default is bi-directional. This can be set at the mapping level OR the field level. When one-way is specified, "a" is always the src object and "b" is always the destination object.

<mapping type="one-way"> 

In the following example the one-way fields are only mapped when "a" object is mapped to "b" object. If "b" is mapped to "a", then the field is not mapped.


  <field type="one-way">

  <field type="one-way">

Excluding Fields One-Way

Dozer supports field excludes going one-way as shown in the example. In the example the field is only excluded when "a" is mapped to "b". If "b" is mapped to "a", then the field is not excluded.

<field-exclude type="one-way"">