Hi all,
I am new to Dozer and trying to do the following mapping but getting the below error. Can some one please help me understand what I am doing wrong and what should be the right approach.
Thanks.
Class structure -
Source = SourceRequest-> Order -> <List>LineItem
Dest = DestRequest - >Doc -> LnItms > <List>LnItm
excerpts from my beanMappping.xml -
<mapping type="one-way" wildcard="false" map-null="false" map-empty-string="false">
<class-a>sourcePackage.Order</class-a>
<class-b>destPackage.Doc</class-b>
<field>
<a>currency</a>
<b>currn</b>
</field>
<field>
<a>lineItems</a>
<b>lnItms.lnItm</b>
<a-hint>sourcePackage.LineItem</a-hint>
<b-hint>destPackage.LnItm</b-hint>
</field>
</mapping>
<mapping type="one-way" wildcard="false" map-null="false" map-empty-string="false">
<class-a>sourcePackage.LineItem</class-a>
<class-b>destPackage.LnItm</class-b>
<field>
<a>id</a>
<b>lnItmId</b>
</field>
<field>
<a>lineNumber</a>
<b>lnItmNm</b>
</field>
</mapping>
I am getting the following exception -
1895 [main] DEBUG org.dozer.fieldmap.FieldMap - Getting ready to invoke write method on the destination object. Dest Obj: Doc, Dest value: [destPackage.LnItm@1315415]
1895 [main] ERROR org.dozer.MappingProcessor - Field mapping error -->
MapId: null
Type: null
Source parent class: sourcePackage.Order
Source field name: lineItems
Source field type: class java.util.ArrayList
Source field value: [sourcePackage.model.LineItem@1b6634c]
Dest parent class: destPackage.Doc
Dest field name: lnItms.lnItm
Dest field type: java.util.List
java.lang.NullPointerException
at org.dozer.util.ReflectionUtils.invoke(ReflectionUtils.java:286)
at org.dozer.propertydescriptor.GetterSetterPropertyDescriptor.writeDeepDestinationValue(GetterSetterPropertyDescriptor.java:240)
at org.dozer.propertydescriptor.GetterSetterPropertyDescriptor.setPropertyValue(GetterSetterPropertyDescriptor.java:86)
at org.dozer.fieldmap.FieldMap.writeDestValue(FieldMap.java:94)