org.hibernate.envers.reader
Class FirstLevelCache

java.lang.Object
  extended by org.hibernate.envers.reader.FirstLevelCache

public class FirstLevelCache
extends Object

First level cache for versioned entities, versions reader-scoped. Each entity is uniquely identified by a revision number and entity id.

Author:
Adam Warski (adam at warski dot org), Hernán Chanfreau

Constructor Summary
FirstLevelCache()
           
 
Method Summary
 boolean contains(String entityName, Number revision, Object id)
           
 boolean containsEntityName(Object id, Number revision, Object entity)
           
 Object get(String entityName, Number revision, Object id)
           
 String getFromEntityNameCache(Object id, Number revision, Object entity)
          Gets the entityName from the cache.
 void put(String entityName, Number revision, Object id, Object entity)
           
 void putOnEntityNameCache(Object id, Number revision, Object entity, String entityName)
          Adds the entityName into the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FirstLevelCache

public FirstLevelCache()
Method Detail

get

public Object get(String entityName,
                  Number revision,
                  Object id)

put

public void put(String entityName,
                Number revision,
                Object id,
                Object entity)

contains

public boolean contains(String entityName,
                        Number revision,
                        Object id)

putOnEntityNameCache

public void putOnEntityNameCache(Object id,
                                 Number revision,
                                 Object entity,
                                 String entityName)
Adds the entityName into the cache. The key is a triple make with primaryKey, revision and entity

Parameters:
entityName, - value of the cache
id, - primaryKey
revision, - revision number
entity, - object retrieved by envers

getFromEntityNameCache

public String getFromEntityNameCache(Object id,
                                     Number revision,
                                     Object entity)
Gets the entityName from the cache. The key is a triple make with primaryKey, revision and entity

Parameters:
entityName, - value of the cache
id, - primaryKey
revision, - revision number
entity, - object retrieved by envers

containsEntityName

public boolean containsEntityName(Object id,
                                  Number revision,
                                  Object entity)
Parameters:
id - , primaryKey
revision - , revision number
entity - , object retrieved by envers
Returns:
true if entityNameCache contains the triple


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