Hi,
I have a problem which causes a 'cannot access loading collection' error. I believe the problem is more to do with the approach I'm taking than a bug, coding or configuration error.
It is very similiar to the problem mentioned on the following page:
http://www.hibernate.org/74.html#A28.
Yet is caused when I try to implement the technique described in this article:
http://www.hibernate.org/193.html.
I have code in one of my 'child' objects which access a collection maintained by the parent object. The code looks a like this:
Code:
public int getIndex() {
return this.getParent().getChildren().indexOf(this);
}
This method is being called when my collection is being lazily initialised and causes Hibernate to complain that I'm trying to access the loading collection, which is fair enough.
My question is: How else can I maintain the index value in a similar fashion?
Thanks in advance.
(i have excluded information about my environment as I believe this is a technique rather than a technical problem)