Joined: Fri Dec 03, 2004 9:44 pm Posts: 6 Location: Eugene, OR
|
I had the "cannot access loading collection" exception thrown by my code. After digging around, I found the explaination. However, I was unable to find any best practice solutions. In my case, I have a parent/child relationship that tries to manipulate the parent collection during the setParent() method on the child.
I found the two following solutions:
The solution suggested by my Hibernate in Action book: put a addXXX method in the parent class. The addXXX method manipulates the child to make sure the parent is set properly.
A solution suggested on the forum: Use the access="field" attribute on the many-to-one property of the child.
Both of these solutions seem to work, but I'm not really sure which would be considered the best practice. Does anybody have any suggestions?
The reason I'm asking is because neither seems ideal.
Richard Hensley
|
|