Hi Ron,
From my experience with Hibernate I would be extremely cautious of using too
many fields in the equals/hashcode of persisted entities (particularly the latter). One specific problem I came accross was that when building a collection of persisted entities, Hibernate adds empty elements to the collection before populating their fields. This is extremely problematic when working with sets, as it means that the objects hashcode can change after it has been added to the set. We resorted to making the hashcodes of persisted objects a fixed integer. Not very efficient, but it worked!
I am guessing here, but I would imagine that in your case Hibernate is trying to get the object's hashcode before it goes about populating the lazy collection. So not really related to the filter, but more to do with the internal workings of Hibernate. Mike On 2/14/07, Ron Anderson <[EMAIL PROTECTED]> wrote:
Hi All, I've been wondering about this for awhile and especially when I forget about it and scratch my head when it happens. Hoping someone can shed some light. I use commonclipse for generating the equals, hashCode and toString methods automatically at the bottom of my pojo's. I've noticed that when you leave a collection in this autogenerated set of methods that you can end up with a 'Yikes' that says illegal access to lazy collection' when you try to view the forms. It looks like the OpenSessionInView filter doesn't work or something else is going on. Any downsides to leaving collections out of the commonclipse generated methods? Does anyone know why this happens? cheers and thanks in advance for any help, Ron
