我这里有个小问题,希望有人能帮我。
我想做一个从对象到整数的映射。对象被标记为获取类型。懒惰.
进行映射时,会收到以下错误消息:
11:31:46,569 ERROR MappingProcessor:253 - Field mapping error -->
MapId: null
Type: null
Source parent class: ClassA
Source field name: MyObjectProperty
Source field type: null
Source field value: null
Dest parent class: ClassB
Dest field name: myIntegerProperty
Dest field type: java.lang.Integer
org.dozer.MappingException: java.lang.reflect.InvocationTargetException
at org.dozer.util.MappingUtils.throwMappingException(MappingUtils.java:88)
at org.dozer.util.ReflectionUtils.invoke(ReflectionUtils.java:258)
at org.dozer.propertydescriptor.GetterSetterPropertyDescriptor.invokeReadMethod(GetterSetterPropertyDescriptor.java:234)
at org.dozer.propertydescriptor.GetterSetterPropertyDescriptor.getPropertyValue(GetterSetterPropertyDescriptor.java:68)
at org.dozer.fieldmap.FieldMap.getSrcFieldValue(FieldMap.java:82)
内部异常:
Caused by: java.lang.IllegalStateException: Attempt to access an unloaded field of detached instance
有趣的是,我可以用另一种方法成功地映射字段,所以整数到对象。
谢谢大家。