I am Serializing an object which has a deep hierarchy of objects.
After deserialization, i am able to access only those fields which were available in object before serialization. For rest, i get LazyInitializationException.
class A {
List<B> objs
}
class B {
C c
}
class C {
D d
}
Initially, i used to get LazyInitializationException while accessing a.objs*.c Then i executed a loop before serialization: a.objs.each{it.c} Now I get LazyInitializationException at a.objs*.c.d and not a.objs*.c
How do I make sure that object fetches each reference from DB before serialization?