This content has been marked as final.
Show 2 replies
-
1. Re: don't want the LazyInitializationExceptoin
abl Jun 12, 2006 2:29 AM (in response to empty11)not sure if I got it right, but if your parent or child relations are annotated with "lazy", you must do all calls to parent and children in an entity context (running transaction). this is normally in a SLSB or SFSB. maybe you should post your Board bean code here ...
-
2. Re: don't want the LazyInitializationExceptoin
empty11 Jun 12, 2006 2:59 AM (in response to empty11)Thanks.
I did Lazy annotation in the relationship as below.@OneToMany(fetch = FetchType.LAZY, mappedBy = "parentBoard") public Collection<Board> getChildBoards() { return childBoards; } public void setChildBoards(Collection<Board> childBoards) { this.childBoards = childBoards; }
And to obtain the root object and his children object , I call a method as below.
So I can get just the Object and his children object.public void obtainOneLevelChild() { childBoards.size(); }
I need not occur LazyInitializationException message in the console or log file
Regards.