MappingException: InvocationTargetException
I have a small problem here and hope that someone can help me out.
I wanna do a mapping from Object to Integer. The Object is marked as Fetchtype.Lazy.
When I do the ma开发者_Go百科pping I get the following error message:
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)
InnerException:
Caused by: java.lang.IllegalStateException: Attempt to access an unloaded field of detached instance
I created a custom converter in dozer xml file but the converter is never called. I guess the application gets a problem before reaching this converter.
Funny thing is I can Map the fields successfully the other way around, so Integer to Object.
I appreciate any ideas, if you need further information please give me a word.
Thx to all.
If this were Hibernate I'd think a lazily loaded field were accessed outside of the Session the data bean is bound to.
I suggest loading the entity and mapping it in the same transaction would solve the problem. I don't know that for sure of course :)
精彩评论