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
.
限定符和类型 | 字段和说明 |
---|---|
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: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).
|
构造器和说明 |
---|
CacheHibernateBlobStore() |
限定符和类型 | 方法和说明 |
---|---|
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) |
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 void delete(Object key)
public void sessionEnd(boolean commit)
sessionEnd
在接口中 CacheStore<K,V>
sessionEnd
在类中 CacheStoreAdapter<K,V>
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
在类中 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.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.8.0-SNAPSHOT Release Date : 四月 9 2019