All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.engine.AssociationKey Maven / Gradle / Ivy

There is a newer version: 3.6.0.Beta2
Show newest version
//$Id: AssociationKey.java 7458 2005-07-12 20:12:57Z oneovthafew $
package org.hibernate.engine;

import java.io.Serializable;

/**
 * Identifies a named association belonging to a particular
 * entity instance. Used to record the fact that an association
 * is null during loading.
 * 
 * @author Gavin King
 */
final class AssociationKey implements Serializable {
	private EntityKey ownerKey;
	private String propertyName;
	
	public AssociationKey(EntityKey ownerKey, String propertyName) {
		this.ownerKey = ownerKey;
		this.propertyName = propertyName;
	}
	
	public boolean equals(Object that) {
		AssociationKey key = (AssociationKey) that;
		return key.propertyName.equals(propertyName) && 
			key.ownerKey.equals(ownerKey);
	}
	
	public int hashCode() {
		return ownerKey.hashCode() + propertyName.hashCode();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy