First of all, Thanks to Michael and s.grinovero, for replying.
Ok! I got it now! But now, I am using Seam Framework, in which you can have something like session-per-conversation pattern, but managed by Seam Framework itself. So less headache for developer. I want to show, tree display, where, it has One to many relationship between Parent and child, ( again, very obvious). Now, when User expands a Parent node, due to session-per-conversation pattern, getting lazily loaded children is something like calling properties like, Parent.getChildren(), for associations, mentioned in Parent. So far, so good. Now, when user collapse this Parent node, I want to remove all children i.e. evict() and want to change the state of Parent so that, when we again access Parent.getChildren(), Hibernate should query for fresh data for available Children. Now here, if Parent is at top level in tree, Evicting all children and querying for that particular Parent will be sufficient to, lazily initialize (with proxy object and no actual data) children collection.
But, now think of situation, where Parent is at say 2nd level in Tree. Thus, Parent itself is into a collection, say at position at 0. Now, I want to remove its children, but, I want Parent to be inside collection. So, that, when Parent = SuperParent( i.e. Parent's parent).getChildren()(getting collection of all nodes at Parent level).get(0); Parent.getChildren(), should query for fresh data for children. I just don't able to figure out , how to achieve this.
I request Michael and s.grinovero to help me out with their experience. Also, input from other members of this Hibernate community is quite welcome.
Thanks Simit
|