org.hibernate.cache.spi
Class CacheKey

java.lang.Object
  extended by org.hibernate.cache.spi.CacheKey
All Implemented Interfaces:
Serializable

public class CacheKey
extends Object
implements Serializable

Allows multiple entity classes / collection roles to be stored in the same cache region. Also allows for composite keys which do not properly implement equals()/hashCode().

See Also:
Serialized Form

Constructor Summary
CacheKey(Serializable id, Type type, String entityOrRoleName, String tenantId, SessionFactoryImplementor factory)
          Construct a new key for a collection or entity instance.
 
Method Summary
 boolean equals(Object other)
           
 String getEntityOrRoleName()
           
 Serializable getKey()
           
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CacheKey

public CacheKey(Serializable id,
                Type type,
                String entityOrRoleName,
                String tenantId,
                SessionFactoryImplementor factory)
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.

Parameters:
id - The identifier associated with the cached data
type - The Hibernate type mapping
entityOrRoleName - The entity or collection-role name.
tenantId - The tenant identifier associated this data.
factory - The session factory for which we are caching
Method Detail

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getKey

public Serializable getKey()

getEntityOrRoleName

public String getEntityOrRoleName()


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