Hi all.
Here is my use case: I am unmarshalling from XML, using JAXB, to a graph of objects in package com.foo.binding, which are copies of my JPA entities from the ORM layer, the latter being in package com.foo.persistence. Thus, the idea is to unmarshal the XML and copy the new graph to the same JPA-annotated object graph and persist those objects.
So here is what I am trying to do:
Mapper mapper = new DozerBeanMapper();
com.foo.persistence.A mappedA = mapper.map(a, com.foo.persistence.A.class);
where a is an instance of com.foo.binding.A, and has exactly the same properties as com.foo.persistence.A.
So I am expecting the mapping to be completely implicit and straightforward.
The particularity of the object graph is that it contains bi-directional relationships. I.e., we have
public class A {
private Set<B> setOfB;
private Set<C> setOfC;
private Set<D> setOfD;
}
and each of B, C, and D has a property of type A, e.g. :
public class B {
private A a;
}
When I attempt to perform the mapping, Dozer goes into an infinite loop and I get java.lang.StackOverflowError.
I'm using Dozer 5.3.2.
Help ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all.
Here is my use case: I am unmarshalling from XML, using JAXB, to a graph of objects in package com.foo.binding, which are copies of my JPA entities from the ORM layer, the latter being in package com.foo.persistence. Thus, the idea is to unmarshal the XML and copy the new graph to the same JPA-annotated object graph and persist those objects.
So here is what I am trying to do:
where a is an instance of com.foo.binding.A, and has exactly the same properties as com.foo.persistence.A.
So I am expecting the mapping to be completely implicit and straightforward.
The particularity of the object graph is that it contains bi-directional relationships. I.e., we have
and each of B, C, and D has a property of type A, e.g. :
When I attempt to perform the mapping, Dozer goes into an infinite loop and I get java.lang.StackOverflowError.
I'm using Dozer 5.3.2.
Help ?
I have the same error !
if you have the answer, I'm interested
Thanks