## org.hibernate.engine.spi
Class EntityKey

    java.lang.Object
      org.hibernate.engine.spi.EntityKey

All Implemented Interfaces:
  Serializable

    public final class EntityKey

extends Object
implements Serializable

Uniquely identifies of an entity instance in a particular session by identifier.

Information used to determine uniqueness consists of the entity-name and the identifier value (see `equals(java.lang.Object)`).

See Also:
  Serialized Form

Constructor Summary
`EntityKey(Serializable id, EntityPersister persister, String tenantId)` Construct a unique identifier for an entity class instance.

Method Summary
`static EntityKey` `deserialize(ObjectInputStream ois, SessionImplementor session)` Custom deserialization routine used during deserialization of a Session/PersistenceContext for increased performance.
`boolean` `equals(Object other)`
`String` `getEntityName()`
`Serializable` `getIdentifier()`
`int` `hashCode()`
`boolean` `isBatchLoadable()`
`void` `serialize(ObjectOutputStream oos)` Custom serialization routine used during serialization of a Session/PersistenceContext for increased performance.
`String` `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### EntityKey

    public EntityKey(Serializable id,
                     EntityPersister persister,
                     String tenantId)

  Construct a unique identifier for an entity class instance.

  NOTE : This signature has changed to accommodate both entity mode and multi-tenancy, both of which relate to the Session to which this key belongs. To help minimize the impact of these changes in the future, the `SessionImplementor.generateEntityKey(java.io.Serializable, org.hibernate.persister.entity.EntityPersister)` method was added to hide the session-specific changes.

  Parameters:
    `id` - The entity id
    `persister` - The entity persister
    `tenantId` - The tenant identifier of the session to which this key belongs

Method Detail

### isBatchLoadable

    public boolean isBatchLoadable()

### getIdentifier

    public Serializable getIdentifier()

### getEntityName

    public String getEntityName()

### equals

    public boolean equals(Object other)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### serialize

    public void serialize(ObjectOutputStream oos)
                   throws IOException

  Custom serialization routine used during serialization of a Session/PersistenceContext for increased performance.

  Parameters:
    `oos` - The stream to which we should write the serial data.
  Throws:
    `IOException` - Thrown by Java I/O

### deserialize

    public static EntityKey deserialize(ObjectInputStream ois,
                                        SessionImplementor session)
                                 throws IOException,
                                        ClassNotFoundException

  Custom deserialization routine used during deserialization of a Session/PersistenceContext for increased performance.

  Parameters:
    `ois` - The stream from which to read the entry.
    `session` - The session being deserialized.
  Returns:
    The deserialized EntityEntry
  Throws:
    `IOException` - Thrown by Java I/O
    `ClassNotFoundException` - Thrown by Java I/O

Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.