Hibernate version: 3.2
For background, I am using a long session pattern.
Well, I have a class Item that has just an id and a name. I wrote an equals method that just compares the name, since that is the business key. The method works fine for when it is transiet. However if I use a DAO to retrieve the same item twice, invoking the equals method on those two objects returns flase. In fact loading one object and comparing it to itself returns false. If I use the == it returns true, but I expected that since the long session will return the same instance from cache.
I know this is a problem dealt with before, but the answer to those was to not use the id field. Well I am not using it, so what is the problem?
|