Re Paul grillo's question:
Say you have an object called Parent, which has a collection containing a set of Child objects. On each child object there is a property called Parent.
You use Hibernate to map this (Parent class has a one-to-many mapping with Child, Child has a many-to-one mapping with Parent.
When you map these two classes in Castor, you have to specify the reference attribute on the Parent object property of Child, otherwise Castor will go into an infinite loop trying to marshall Parent which marshalls Child which marshalls Parent which marshalls Child etc etc.
Now if you load a Parent and its set of Child objects via Hibernate, by default the collection contains a Set of CGLIB generated proxies for the children, which a class name which is something like Child$$Enhanced by CGLIB$$. Castor doesn't recognise this as a mapped class, even though Child is mapped, because it's dealing with the proxy not the real class.
This being so it ends up introspecting the proxy class, rather than following the mapping for the real class. It is therefore unaware that the Parent object on the proxied Child class is a reference, so it goes into an infinite loop, as if you had left off the reference attribute for the child.
I think the above is just another example of the main problem described on this Jira entry. If necessary I can provide an Eclipse project that will demonstrate the above via a Junit test case, however it would be quite a large post, due to the inclusion of Hibernate, CGLIB, Castor and Spring jar files amongst others.
Would this be helpful or can we get on without this ?
By the way the workaround for Hibernate is to make all one-to-many relationships to be lazy="false", and all many-to-one relationships to be set to outer-join="true". This is not ideal as lazy is preferred so as not to dredge out a large portion of the domain model on a single query, but it's something we can live with just about.