public class CacheHibernateBlobStore<K,V> extends CacheStoreAdapter<K,V>
CacheStore
implementation backed by Hibernate. This implementation
stores objects in underlying database in BLOB
format.
setSessionFactory(SessionFactory)
or
setHibernateConfigurationPath(String)
or
setHibernateProperties(Properties)
should be set.
If session factory is provided it should contain
CacheHibernateBlobStoreEntry
persistent class (via provided
mapping file GridCacheHibernateStoreEntry.hbm.xml
or by
adding CacheHibernateBlobStoreEntry
to annotated classes
of session factory.
Path to hibernate configuration may be either an URL or a file path or
a classpath resource. This configuration file should include provided
mapping GridCacheHibernateStoreEntry.hbm.xml
or include annotated
class CacheHibernateBlobStoreEntry
.
If hibernate properties are provided, mapping
GridCacheHibernateStoreEntry.hbm.xml
is included automatically.
Use CacheHibernateBlobStoreFactory
factory to pass CacheHibernateBlobStore
to CacheConfiguration
.
Modifier and Type | Field and Description |
---|---|
static String |
DFLT_CONN_POOL_SIZE
Default hibernate.connection.pool_size property value (value is 64).
|
static String |
DFLT_CONN_URL
Default connection URL
(value is jdbc:gg-h2:mem:hibernateCacheStore;DB_CLOSE_DELAY=-1;DEFAULT_LOCK_TIMEOUT=5000).
|
static String |
DFLT_HBM2DDL_AUTO
Default hibernate.hbm2ddl.auto property value (value is true).
|
static String |
DFLT_SHOW_SQL
Default show SQL property value (value is true).
|
Constructor and Description |
---|
CacheHibernateBlobStore() |
Modifier and Type | Method and Description |
---|---|
void |
delete(Object key) |
protected <X> X |
fromBytes(byte[] bytes)
Deserialize object from byte array using marshaller.
|
V |
load(K key) |
void |
sessionEnd(boolean commit)
Default empty implementation for ending transactions.
|
void |
setHibernateConfigurationPath(String hibernateCfgPath)
Sets hibernate configuration path.
|
void |
setHibernateProperties(Properties hibernateProps)
Sets Hibernate properties.
|
void |
setSessionFactory(org.hibernate.SessionFactory sesFactory)
Sets session factory.
|
protected byte[] |
toBytes(Object obj)
Serialize object to byte array using marshaller.
|
String |
toString() |
void |
write(javax.cache.Cache.Entry<? extends K,? extends V> entry) |
deleteAll, loadAll, loadCache, writeAll
public static final String DFLT_CONN_URL
public static final String DFLT_SHOW_SQL
public static final String DFLT_HBM2DDL_AUTO
public static final String DFLT_CONN_POOL_SIZE
public void delete(Object key)
public void sessionEnd(boolean commit)
sessionEnd
in interface CacheStore<K,V>
sessionEnd
in class CacheStoreAdapter<K,V>
commit
- True
if transaction should commit, false
for rollback.public void setSessionFactory(org.hibernate.SessionFactory sesFactory)
sesFactory
- Session factory.public void setHibernateConfigurationPath(String hibernateCfgPath)
This may be either URL or file path or classpath resource.
hibernateCfgPath
- URL or file path or classpath resource
pointing to hibernate configuration XML file.public void setHibernateProperties(Properties hibernateProps)
hibernateProps
- Hibernate properties.public String toString()
toString
in class CacheStoreAdapter<K,V>
protected byte[] toBytes(Object obj) throws IgniteCheckedException
obj
- Object to convert to byte array.IgniteCheckedException
- If failed to convert.protected <X> X fromBytes(byte[] bytes) throws IgniteCheckedException
X
- Result object type.bytes
- Bytes to deserialize.IgniteCheckedException
- If failed.
GridGain In-Memory Computing Platform : ver. 8.9.15 Release Date : December 3 2024