Hibernate version: 3.2.1
Hello,
Here is an excerpt of my equal method:
Code:
    public boolean equals(final Object obj) {
        if (this == obj) {
            return true;
        }
        if (!super.equals(obj)) {
            return false;
        }
//        FIXME: need to equal the classes
//        if (getClass() != obj.getClass()) {
//            return false;
//        }
[code]//        if (getClass().isAssignableFrom(obj.getClass())) {
//            return false;
//        }[/code]
//More business comparison here...
My problem is that following return always false :
Code:
//        if (getClass() != obj.getClass()) {
//            return false;
//        }
and
Code:
//        if (getClass().isAssignableFrom(obj.getClass())) {
//            return false;
//        }
which poses problems in the future. 
This problem doesn't happen all the time. Only when using a proxy and a transient object.
e.g. myPersistentObject.equals(myTransientObject) or vice versa.
The casting do work, but it's unsafe as long I haven't checked the class.
I'm using the cglib bytecode.
How can I check that my method argument is of the same class as the class on which the equals is called?
Thx in advance for any input.