I'm having trouble with the equals() methods of my persistent object, shich seems to be a result of CGLIB enhancement. I'm not sure how to tell Hibernate to produce enhanced classes that don't break my code...
Here's a simplified example:
class Foo {
private String fooProp;
public String getFooProp() ...
public boolean equals(Object other) {
if (other == null) return false;
if (! other instanceof Foo) return false;
if (! fooProp.equals((Foo) other).fooProp) return false;
return true;
}
}
The problem is that, when other has been enhanced, other.fooProp is evaluating to null. other.getFooProp() returns the correct value, though.
So, short of rewritinging every line of code I have that references a field directly to use accessors, how do I fix this? Is there something I can configure to make the bytecode enhancement more robust?
L.
_________________ Laurie Harper
Open Source advocate, Java geek: http://www.holoweb.net/laurie
Founder, Zotech Software: http://www.zotechsoftware.com/
|