org.hibernate.cache

Class CacheKey

Implemented Interfaces:
Serializable

public class CacheKey
extends java.lang.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().
Author:
Gavin King

Constructor Summary

CacheKey(Serializable id, Type type, String entityOrRoleName, EntityMode entityMode, 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()

Constructor Details

CacheKey

public CacheKey(Serializable id,
                Type type,
                String entityOrRoleName,
                EntityMode entityMode,
                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.
entityMode - The entiyt mode of the originating session
factory - The session factory for which we are caching

Method Details

equals

public boolean equals(Object other)

getEntityOrRoleName

public String getEntityOrRoleName()

getKey

public Serializable getKey()

hashCode

public int hashCode()

toString

public String toString()