|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.tangosol.util.Base com.tangosol.coherence.hibernate.HibernateCacheLoader
public class HibernateCacheLoader
Data-driven CacheLoader implementation for Hibernate tables
These methods all follow the pattern of: 1) open session 2) begin transaction 3) do work 4) commit transaction (or rollback on exception and rethrow) 5) close session
Field Summary | |
---|---|
protected static String |
PARAM_IDS
Name of the "ids" named parameter in HQL bulk queries |
Constructor Summary | |
---|---|
HibernateCacheLoader(String sEntityName)
Constructor which accepts an entityName. |
|
HibernateCacheLoader(String sEntityName,
File configurationFile)
Constructor which accepts an entityName and a hibernate configuration resource. |
|
HibernateCacheLoader(String sEntityName,
String sResource)
Constructor which accepts an entityName and a hibernate configuration resource. |
Method Summary | |
---|---|
protected void |
closeSession(org.hibernate.Session session)
Close a Hibernate Session. |
protected Object |
createEntityFromId(Object id)
Create a transient entity instance given an entity id |
protected void |
ensureInitialized()
Called by all API-implementing methods for lazy initialization. |
protected org.hibernate.metadata.ClassMetadata |
getEntityClassMetadata()
Get the Hibernate ClassMetadata for the Hibernate entity |
protected String |
getEntityName()
Get the Hibernate entity name |
protected String |
getLoadAllQuery()
Get the parameterized loadAll HQL query string |
protected org.hibernate.SessionFactory |
getSessionFactory()
Get the Hibernate SessionFactory. |
protected void |
initialize()
Initializer (must be called post-constructor) We do this specifically so that derived classes can safely create override methods that depend on a fully constructed object state. |
Object |
load(Object key)
Load a Hibernate entity given an id (key) |
Map |
loadAll(Collection keys)
Load a collection of Hibernate entities given a set of ids (keys) |
protected org.hibernate.Session |
openSession()
Open a Hibernate Session. |
protected void |
setEntityClassMetadata(org.hibernate.metadata.ClassMetadata entityClassMetadata)
Get the Hibernate ClassMetadata for the Hibernate entity |
protected void |
setLoadAllQuery(String sLoadAllQuery)
Get the parameterized loadAll HQL query string |
protected void |
validateIdentifier(Serializable id,
Object entity)
Ensure that there are no conflicts between an explicit and implicit key. |
Field Detail |
---|
protected static final String PARAM_IDS
Constructor Detail |
---|
public HibernateCacheLoader(String sEntityName)
sEntityName
- the Hibernate entity (i.e., the HQL table name)public HibernateCacheLoader(String sEntityName, String sResource)
sEntityName
- Hibernate entity (i.e. the HQL table name)sResource
- Hibernate config classpath resource (e.g. hibernate.cfg.xml)public HibernateCacheLoader(String sEntityName, File configurationFile)
sEntityName
- Hibernate entity (i.e. the HQL table name)configurationFile
- Hibernate config file (e.g. hibernate.cfg.xml)Method Detail |
---|
protected void initialize()
protected void ensureInitialized()
public Object load(Object key)
load
in interface CacheLoader
key
- the cache key; specifically, the entity id
public Map loadAll(Collection keys)
loadAll
in interface CacheLoader
keys
- the cache keys; specifically, the entity ids
protected org.hibernate.Session openSession()
protected void closeSession(org.hibernate.Session session)
session
- the Hibernate Session objectprotected org.hibernate.SessionFactory getSessionFactory()
protected String getEntityName()
protected org.hibernate.metadata.ClassMetadata getEntityClassMetadata()
protected void setEntityClassMetadata(org.hibernate.metadata.ClassMetadata entityClassMetadata)
entityClassMetadata
- the ClassMetadata objectprotected String getLoadAllQuery()
protected void setLoadAllQuery(String sLoadAllQuery)
sLoadAllQuery
- a parameterized HQL query stringprotected Object createEntityFromId(Object id)
id
- the Hibernate entity id
protected void validateIdentifier(Serializable id, Object entity)
id
- the explicit keyentity
- an entity (containing an implicit key)
|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |