[hibernate-commits] Hibernate SVN: r11500 - branches/Branch_3_2/Hibernate3/src/org/hibernate/cache.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Wed May 9 13:36:09 EDT 2007


Author: steve.ebersole at jboss.com
Date: 2007-05-09 13:36:08 -0400 (Wed, 09 May 2007)
New Revision: 11500

Modified:
   branches/Branch_3_2/Hibernate3/src/org/hibernate/cache/CacheKey.java
Log:
HHH-2316 : CacheKey.equals()

Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/cache/CacheKey.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/cache/CacheKey.java	2007-05-09 17:35:55 UTC (rev 11499)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/cache/CacheKey.java	2007-05-09 17:36:08 UTC (rev 11500)
@@ -25,19 +25,24 @@
 	 * Construct a new key for a collection or entity instance.
 	 * Note that an entity name should always be the root entity 
 	 * name, not a subclass entity name.
+	 *
+	 * @param id The identifier associated with the cached data
+	 * @param type The Hibernate type mapping
+	 * @param entityOrRoleName The entity or collection-role name.
+	 * @param entityMode The entiyt mode of the originating session
+	 * @param factory The session factory for which we are caching
 	 */
 	public CacheKey(
 			final Serializable id, 
 			final Type type, 
 			final String entityOrRoleName, 
 			final EntityMode entityMode, 
-			final SessionFactoryImplementor factory
-	) {
+			final SessionFactoryImplementor factory) {
 		this.key = id;
 		this.type = type;
 		this.entityOrRoleName = entityOrRoleName;
 		this.entityMode = entityMode;
-		hashCode = type.getHashCode(key, entityMode, factory);
+		hashCode = type.getHashCode( key, entityMode, factory );
 	}
 
 	//Mainly for OSCache
@@ -48,8 +53,8 @@
 	public boolean equals(Object other) {
 		if ( !(other instanceof CacheKey) ) return false;
 		CacheKey that = (CacheKey) other;
-		return type.isEqual(key, that.key, entityMode) && 
-			entityOrRoleName.equals(that.entityOrRoleName);
+		return entityOrRoleName.equals( that.entityOrRoleName )
+				&& type.isEqual( key, that.key, entityMode );
 	}
 
 	public int hashCode() {




More information about the hibernate-commits mailing list