diff --git a/src/helma/objectmodel/DbKey.java b/src/helma/objectmodel/DbKey.java index 28a0a7ab..b5fb83ed 100644 --- a/src/helma/objectmodel/DbKey.java +++ b/src/helma/objectmodel/DbKey.java @@ -5,6 +5,7 @@ package helma.objectmodel; import java.io.Serializable; + /** * This is the internal representation of a database key. It is constructed * out of the database URL, the table name, the user name and the database @@ -15,7 +16,7 @@ public final class DbKey implements Key, Serializable { private final String storageName; private final String id; - private final int hash; + // private transient int hash; /** @@ -24,13 +25,10 @@ public final class DbKey implements Key, Serializable { public DbKey (DbMapping dbmap, String id) { this.id = id; this.storageName = dbmap == null ? null : dbmap.getStorageTypeName (); - hash = id.hashCode (); } public boolean equals (Object what) { - if (what == this) - return true; try { DbKey k = (DbKey) what; return (storageName == k.storageName || storageName.equals (k.storageName)) && @@ -41,7 +39,8 @@ public final class DbKey implements Key, Serializable { } public int hashCode () { - return hash; + return storageName == null ? id.hashCode () : storageName.hashCode() + id.hashCode (); + // return hash; } public Key getParentKey () { @@ -115,5 +114,6 @@ public final class DbKey implements Key, Serializable { + diff --git a/src/helma/objectmodel/SyntheticKey.java b/src/helma/objectmodel/SyntheticKey.java index 8de44aae..cd37c4c8 100644 --- a/src/helma/objectmodel/SyntheticKey.java +++ b/src/helma/objectmodel/SyntheticKey.java @@ -15,7 +15,7 @@ public final class SyntheticKey implements Key, Serializable { private final Key parentKey; private final String name; - private final int hash; + // private final int hash; /** @@ -24,7 +24,7 @@ public final class SyntheticKey implements Key, Serializable { public SyntheticKey (Key key, String name) { this.parentKey = key; this.name = name; - hash = name.hashCode () + key.hashCode (); + // hash = name.hashCode () + key.hashCode (); } @@ -40,7 +40,8 @@ public final class SyntheticKey implements Key, Serializable { } public int hashCode () { - return hash; + // return hash; + return name.hashCode () + parentKey.hashCode (); } @@ -114,5 +115,6 @@ public final class SyntheticKey implements Key, Serializable { +