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
|
@ -14,7 +14,7 @@
|
|||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.openjpa.util;
|
||||
|
||||
|
@ -52,23 +52,25 @@ public class BigDecimalId
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
if (key == null)
|
||||
if (key == null) {
|
||||
return "NULL";
|
||||
|
||||
}
|
||||
return key.toString();
|
||||
}
|
||||
|
||||
protected int idHash() {
|
||||
if (key != null)
|
||||
if (key != null) {
|
||||
return key.hashCode();
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected boolean idEquals(OpenJPAId other) {
|
||||
if(key == null)
|
||||
if ((key == null) ||
|
||||
(!BigDecimalId.class.isAssignableFrom(other.getClass()))) {
|
||||
return false;
|
||||
|
||||
return key.equals(other);
|
||||
}
|
||||
return key.equals(((BigDecimalId)other).key);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.openjpa.util;
|
||||
|
||||
|
@ -52,24 +52,25 @@ public class BigIntegerId
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
if (key == null)
|
||||
if (key == null) {
|
||||
return "NULL";
|
||||
|
||||
}
|
||||
return key.toString();
|
||||
}
|
||||
|
||||
protected int idHash() {
|
||||
if (key != null)
|
||||
if (key != null) {
|
||||
return key.hashCode();
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected boolean idEquals(OpenJPAId other) {
|
||||
if (key == null)
|
||||
if ((key == null) ||
|
||||
(!BigIntegerId.class.isAssignableFrom(other.getClass()))) {
|
||||
return false;
|
||||
|
||||
return key.equals(other);
|
||||
}
|
||||
return key.equals(((BigIntegerId)other).key);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue