mirror of https://github.com/apache/openjpa.git
OPENJPA-1120 idEquals() broken in BigDecimalId and BigIntegerId. Patch contributed by Dieter Von Holten with additional updates from Albert Lee.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@799132 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8ca7664bd9
commit
16344b5b33
|
@ -52,23 +52,25 @@ public class BigDecimalId
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (key == null)
|
if (key == null) {
|
||||||
return "NULL";
|
return "NULL";
|
||||||
|
}
|
||||||
return key.toString();
|
return key.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int idHash() {
|
protected int idHash() {
|
||||||
if (key != null)
|
if (key != null) {
|
||||||
return key.hashCode();
|
return key.hashCode();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean idEquals(OpenJPAId other) {
|
protected boolean idEquals(OpenJPAId other) {
|
||||||
if(key == null)
|
if ((key == null) ||
|
||||||
|
(!BigDecimalId.class.isAssignableFrom(other.getClass()))) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return key.equals(other);
|
return key.equals(((BigDecimalId)other).key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,24 +52,25 @@ public class BigIntegerId
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (key == null)
|
if (key == null) {
|
||||||
return "NULL";
|
return "NULL";
|
||||||
|
}
|
||||||
return key.toString();
|
return key.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int idHash() {
|
protected int idHash() {
|
||||||
if (key != null)
|
if (key != null) {
|
||||||
return key.hashCode();
|
return key.hashCode();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean idEquals(OpenJPAId other) {
|
protected boolean idEquals(OpenJPAId other) {
|
||||||
if (key == null)
|
if ((key == null) ||
|
||||||
|
(!BigIntegerId.class.isAssignableFrom(other.getClass()))) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return key.equals(other);
|
|
||||||
}
|
}
|
||||||
|
return key.equals(((BigIntegerId)other).key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue