Index: src/java/javax/jdo/identity/ByteIdentity.java
===================================================================
--- src/java/javax/jdo/identity/ByteIdentity.java	(revision 671813)
+++ src/java/javax/jdo/identity/ByteIdentity.java	(working copy)
@@ -105,6 +105,22 @@
         }
     }
 
+    /** Determine the ordering of identity objects.
+     * @param o Other identity
+     * @return The relative ordering between the objects
+     * @since 2.2
+     */
+    public int compareTo(Object o) {
+        if (o instanceof ByteIdentity) {
+        	ByteIdentity other = (ByteIdentity)o;
+            return (int)(key - other.key);
+        }
+        else if (o == null) {
+            throw new ClassCastException("object is null");
+        }
+        throw new ClassCastException(this.getClass().getName() + " != " + o.getClass().getName());
+    }
+
     /** Create the key as an Object.
      * @return the key as an Object
      * @since 2.0
Index: src/java/javax/jdo/identity/CharIdentity.java
===================================================================
--- src/java/javax/jdo/identity/CharIdentity.java	(revision 671813)
+++ src/java/javax/jdo/identity/CharIdentity.java	(working copy)
@@ -113,6 +113,22 @@
         }
     }
 
+    /** Determine the ordering of identity objects.
+     * @param o Other identity
+     * @return The relative ordering between the objects
+     * @since 2.2
+     */
+    public int compareTo(Object o) {
+        if (o instanceof CharIdentity) {
+        	CharIdentity other = (CharIdentity)o;
+            return (int)(key - other.key);
+        }
+        else if (o == null) {
+            throw new ClassCastException("object is null");
+        }
+        throw new ClassCastException(this.getClass().getName() + " != " + o.getClass().getName());
+    }
+
     /** Create the key as an Object.
      * @return the key as an Object
      * @since 2.0
Index: src/java/javax/jdo/identity/IntIdentity.java
===================================================================
--- src/java/javax/jdo/identity/IntIdentity.java	(revision 671813)
+++ src/java/javax/jdo/identity/IntIdentity.java	(working copy)
@@ -102,6 +102,22 @@
         }
     }
 
+    /** Determine the ordering of identity objects.
+     * @param o Other identity
+     * @return The relative ordering between the objects
+     * @since 2.2
+     */
+    public int compareTo(Object o) {
+        if (o instanceof IntIdentity) {
+        	IntIdentity other = (IntIdentity)o;
+            return key - other.key;
+        }
+        else if (o == null) {
+            throw new ClassCastException("object is null");
+        }
+        throw new ClassCastException(this.getClass().getName() + " != " + o.getClass().getName());
+    }
+
     /** Create the key as an Object.
      * @return the key as an Object
      * @since 2.0
Index: src/java/javax/jdo/identity/LongIdentity.java
===================================================================
--- src/java/javax/jdo/identity/LongIdentity.java	(revision 671813)
+++ src/java/javax/jdo/identity/LongIdentity.java	(working copy)
@@ -103,6 +103,22 @@
         }
     }
 
+    /** Determine the ordering of identity objects.
+     * @param o Other identity
+     * @return The relative ordering between the objects
+     * @since 2.2
+     */
+    public int compareTo(Object o) {
+        if (o instanceof LongIdentity) {
+        	LongIdentity other = (LongIdentity)o;
+            return (int)(key - other.key);
+        }
+        else if (o == null) {
+            throw new ClassCastException("object is null");
+        }
+        throw new ClassCastException(this.getClass().getName() + " != " + o.getClass().getName());
+    }
+
     /** Create the key as an Object.
      * @return the key as an Object
      * @since 2.0
Index: src/java/javax/jdo/identity/ObjectIdentity.java
===================================================================
--- src/java/javax/jdo/identity/ObjectIdentity.java	(revision 671813)
+++ src/java/javax/jdo/identity/ObjectIdentity.java	(working copy)
@@ -133,6 +133,16 @@
         }
     }
 
+    /** Determine the ordering of identity objects.
+     * @param o Other identity
+     * @return The relative ordering between the objects
+     * @since 2.2
+     */
+    public int compareTo(Object o) {
+    	// Just disallow comparison. Could make some assumptions about being Date, Locale etc
+        throw new ClassCastException("ObjectIdentity cannot be used for comparator ordering");
+    }
+
     /** Write this object. Write the superclass first.
      * @param out the output
      */
Index: src/java/javax/jdo/identity/ShortIdentity.java
===================================================================
--- src/java/javax/jdo/identity/ShortIdentity.java	(revision 671813)
+++ src/java/javax/jdo/identity/ShortIdentity.java	(working copy)
@@ -102,6 +102,22 @@
         }
     }
 
+    /** Determine the ordering of identity objects.
+     * @param o Other identity
+     * @return The relative ordering between the objects
+     * @since 2.2
+     */
+    public int compareTo(Object o) {
+        if (o instanceof ShortIdentity) {
+        	ShortIdentity other = (ShortIdentity)o;
+            return key - other.key;
+        }
+        else if (o == null) {
+            throw new ClassCastException("object is null");
+        }
+        throw new ClassCastException(this.getClass().getName() + " != " + o.getClass().getName());
+    }
+
     /** Create the key as an Object.
      * @return the key as an Object
      * @since 2.0
Index: src/java/javax/jdo/identity/SingleFieldIdentity.java
===================================================================
--- src/java/javax/jdo/identity/SingleFieldIdentity.java	(revision 671813)
+++ src/java/javax/jdo/identity/SingleFieldIdentity.java	(working copy)
@@ -40,7 +40,7 @@
  * @version 2.0
  */
 public abstract class SingleFieldIdentity
-    implements Externalizable {
+    implements Externalizable, Comparable {
     
     /** The Internationalization message helper.
      */
Index: src/java/javax/jdo/identity/StringIdentity.java
===================================================================
--- src/java/javax/jdo/identity/StringIdentity.java	(revision 671814)
+++ src/java/javax/jdo/identity/StringIdentity.java	(working copy)
@@ -78,6 +78,22 @@
         }
     }
 
+    /** Determine the ordering of identity objects.
+     * @param o Other identity
+     * @return The relative ordering between the objects
+     * @since 2.2
+     */
+    public int compareTo(Object o) {
+        if (o instanceof StringIdentity) {
+            StringIdentity other = (StringIdentity)o;
+            return ((String)this.keyAsObject).compareTo((String)other.keyAsObject);
+        }
+        else if (o == null) {
+            throw new ClassCastException("object is null");
+        }
+        throw new ClassCastException(this.getClass().getName() + " != " + o.getClass().getName());
+    }
+
     /** Write this object. Write the superclass first.
      * @param out the output
      */
Index: test/java/javax/jdo/identity/ConcreteTestIdentity.java
===================================================================
--- test/java/javax/jdo/identity/ConcreteTestIdentity.java	(revision 671814)
+++ test/java/javax/jdo/identity/ConcreteTestIdentity.java	(working copy)
@@ -42,7 +42,16 @@
         public ConcreteTestIdentity() {
             super();
         }
-        
+
+        /** Determine the ordering of identity objects.
+         * @param o Other identity
+         * @return The relative ordering between the objects
+         * @since 2.2
+         */
+        public int compareTo(Object o) {
+            throw new ClassCastException("Not implemented");
+        }
+
         public void writeExternal(ObjectOutput out) throws IOException {
             super.writeExternal(out);
         } 
