Used to uniquely key an entity instance in relation to a particular session
by some unique property reference, as opposed to identifier.
Uniqueing information consists of the entity-name, the referenced
property name, and the referenced property value.
Method from org.hibernate.engine.EntityUniqueKey Detail: |
static EntityUniqueKey deserialize(ObjectInputStream ois,
SessionImplementor session) throws IOException, ClassNotFoundException {
return new EntityUniqueKey(
( String ) ois.readObject(),
( String ) ois.readObject(),
ois.readObject(),
( Type ) ois.readObject(),
( EntityMode ) ois.readObject(),
session.getFactory()
);
}
Custom deserialization routine used during deserialization of a
Session/PersistenceContext for increased performance. |
public boolean equals(Object other) {
EntityUniqueKey that = (EntityUniqueKey) other;
return that.entityName.equals(entityName) &&
that.uniqueKeyName.equals(uniqueKeyName) &&
keyType.isEqual(that.key, key, entityMode);
}
|
public int generateHashCode(SessionFactoryImplementor factory) {
int result = 17;
result = 37 * result + entityName.hashCode();
result = 37 * result + uniqueKeyName.hashCode();
result = 37 * result + keyType.getHashCode(key, entityMode, factory);
return result;
}
|
public String getEntityName() {
return entityName;
}
|
public Object getKey() {
return key;
}
|
public String getUniqueKeyName() {
return uniqueKeyName;
}
|
public int hashCode() {
return hashCode;
}
|
void serialize(ObjectOutputStream oos) throws IOException {
checkAbilityToSerialize();
oos.writeObject( uniqueKeyName );
oos.writeObject( entityName );
oos.writeObject( key );
oos.writeObject( keyType );
oos.writeObject( entityMode );
}
Custom serialization routine used during serialization of a
Session/PersistenceContext for increased performance. |
public String toString() {
return "EntityUniqueKey" + MessageHelper.infoString(entityName, uniqueKeyName, key);
}
|