fabio valsecchi [
https://community.jboss.org/people/fabiovalse] created the discussion
"Re: Entity hashCode and equals overriding"
To view the discussion, visit:
https://community.jboss.org/message/787964#787964
--------------------------------------------------------------
I've just fix the problem! I've changed the code in this way:
-------------------------------------------------------
@Override
public boolean equals(Object o) {
if (o==this)
return true;
if (o instanceof Book) {
if (this.isbn.compareTo(((Book) o).getIsbn()) == 0)
return true;
else return false;
}
return false;
}
-------------------------------------------------------
The problem was the comparison between string! Now I use the compareTo() method and
everything correctly works.
Thank you for your time Piotr!
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/787964#787964]
Start a new discussion in EJB3 Development at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]