|
Oracle® Coherence Java API Reference Release 3.7.1.0 E22843-01 |
|||||||
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:
Field Summary | |
---|---|
protected static java.lang.String |
PARAM_IDS Name of the "ids" named parameter in HQL bulk queries |
Constructor Summary | |
---|---|
HibernateCacheLoader() Default constructor. |
|
HibernateCacheLoader(java.lang.String sEntityName) Constructor which accepts an entityName. |
|
HibernateCacheLoader(java.lang.String sEntityName, java.io.File configurationFile) Constructor which accepts an entityName and a Hibernate configuration resource. |
|
HibernateCacheLoader(java.lang.String sEntityName, SessionFactory sessionFactory) Constructor which accepts an entityName and a Hibernate SessionFactory. |
|
HibernateCacheLoader(java.lang.String sEntityName, java.lang.String sResource) Constructor which accepts an entityName and a Hibernate configuration resource. |
Method Summary | |
---|---|
protected void |
closeSession(Session session) Close a Hibernate Session. |
protected java.lang.Object |
createEntityFromId(java.lang.Object id) Create a transient entity instance given an entity id |
protected void |
ensureInitialized() Called by all API-implementing methods for lazy initialization. |
protected ClassMetadata |
getEntityClassMetadata() Get the Hibernate ClassMetadata for the Hibernate entity |
protected java.lang.String |
getEntityName() Get the Hibernate entity name |
protected java.lang.String |
getLoadAllQuery() Get the parameterized loadAll HQL query string |
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. |
java.lang.Object |
load(java.lang.Object key) Load a Hibernate entity given an id (key) |
java.util.Map |
loadAll(java.util.Collection keys) Load a collection of Hibernate entities given a set of ids (keys) |
protected Session |
openSession() Open a Hibernate Session. |
protected void |
setEntityClassMetadata(ClassMetadata entityClassMetadata) Get the Hibernate ClassMetadata for the Hibernate entity |
void |
setEntityName(java.lang.String sEntityName) Set the Hibernate entity name. |
protected void |
setLoadAllQuery(java.lang.String sLoadAllQuery) Get the parameterized loadAll HQL query string |
void |
setSessionFactory(SessionFactory sessionFactory) Set the Hibernate SessionFactory to be used by this CacheLoader. |
protected void |
validateIdentifier(java.io.Serializable id, java.lang.Object entity) Ensure that there are no conflicts between an explicit and implicit key. |
Field Detail |
---|
protected static final java.lang.String PARAM_IDS
Constructor Detail |
---|
public HibernateCacheLoader()
public HibernateCacheLoader(java.lang.String sEntityName)
sEntityName
- the Hibernate entity (i.e., the HQL table name)public HibernateCacheLoader(java.lang.String sEntityName, java.lang.String sResource)
sEntityName
- Hibernate entity (i.e. the HQL table name)sResource
- Hibernate config classpath resource (e.g. hibernate.cfg.xml)public HibernateCacheLoader(java.lang.String sEntityName, java.io.File configurationFile)
sEntityName
- Hibernate entity (i.e. the HQL table name)configurationFile
- Hibernate config file (e.g. hibernate.cfg.xml)public HibernateCacheLoader(java.lang.String sEntityName, SessionFactory sessionFactory)
sEntityName
- Hibernate entity (i.e. the HQL table name)sessionFactory
- Hibernate SessionFactoryMethod Detail |
---|
public SessionFactory getSessionFactory()
public void setSessionFactory(SessionFactory sessionFactory)
sessionFactory
- the Hibernate SessionFactoryjava.lang.IllegalStateException
- if the session factory has already been setprotected java.lang.String getEntityName()
public void setEntityName(java.lang.String sEntityName)
sEntityName
- the entity namejava.lang.IllegalStateException
- if the entity name has already been setprotected void initialize()
We do this specifically so that derived classes can safely create override methods that depend on a fully constructed object state. Will only be called once per instance and prior to the main body of any API methods. This should not be directly called by derived classes. If this method is overridden, super must be called at the end of the overriding method.
protected void ensureInitialized()
public java.lang.Object load(java.lang.Object key)
load
in interface CacheLoader
key
- the cache key; specifically, the entity idpublic java.util.Map loadAll(java.util.Collection keys)
loadAll
in interface CacheLoader
keys
- the cache keys; specifically, the entity idsprotected Session openSession()
protected void closeSession(Session session)
session
- the Hibernate Session objectprotected ClassMetadata getEntityClassMetadata()
protected void setEntityClassMetadata(ClassMetadata entityClassMetadata)
entityClassMetadata
- the ClassMetadata objectprotected java.lang.String getLoadAllQuery()
protected void setLoadAllQuery(java.lang.String sLoadAllQuery)
sLoadAllQuery
- a parameterized HQL query stringprotected java.lang.Object createEntityFromId(java.lang.Object id)
id
- the Hibernate entity idprotected void validateIdentifier(java.io.Serializable id, java.lang.Object entity)
id
- the explicit keyentity
- an entity (containing an implicit key)
|
Oracle® Coherence Java API Reference Release 3.7.1.0 E22843-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |