KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > engine > AssociationKey


1 //$Id: AssociationKey.java,v 1.2 2005/07/12 20:12:53 oneovthafew Exp $
2
package org.hibernate.engine;
3
4 import java.io.Serializable JavaDoc;
5
6 /**
7  * Identifies a named association belonging to a particular
8  * entity instance. Used to record the fact that an association
9  * is null during loading.
10  *
11  * @author Gavin King
12  */

13 final class AssociationKey implements Serializable JavaDoc {
14     private EntityKey ownerKey;
15     private String JavaDoc propertyName;
16     
17     public AssociationKey(EntityKey ownerKey, String JavaDoc propertyName) {
18         this.ownerKey = ownerKey;
19         this.propertyName = propertyName;
20     }
21     
22     public boolean equals(Object JavaDoc that) {
23         AssociationKey key = (AssociationKey) that;
24         return key.propertyName.equals(propertyName) &&
25             key.ownerKey.equals(ownerKey);
26     }
27     
28     public int hashCode() {
29         return ownerKey.hashCode() + propertyName.hashCode();
30     }
31 }
Popular Tags