org.openspaces.persistency.hibernate
Class StatelessHibernateExternalDataSource
java.lang.Object
org.openspaces.persistency.hibernate.AbstractHibernateExternalDataSource
org.openspaces.persistency.hibernate.StatelessHibernateExternalDataSource
- All Implemented Interfaces:
- BulkDataPersister, ManagedDataSource, SQLDataProvider, ManagedDataSourceEntriesProvider
public class StatelessHibernateExternalDataSource
- extends AbstractHibernateExternalDataSource
- implements BulkDataPersister, SQLDataProvider
An external data source implemenation based on Hiberante StatelessSession
.
Note, stateless session is much faster than regular Hibernate session, but at the expense of not having
a first level cache, as well as not performing any cascading operations (both in read operations as well as
dirty operations).
- Author:
- kimchy
Methods inherited from class org.openspaces.persistency.hibernate.AbstractHibernateExternalDataSource |
createInitialLoadIterator, getFetchSize, getInitialLoadChunkSize, getInitialLoadEntries, getManagedEntries, getSessionFactory, init, isManagedEntry, isPerformOrderById, isUseScrollableResultSet, setFetchSize, setInitialLoadChunkSize, setInitialLoadEntries, setInitialLoadThreadPoolSize, setManagedEntries, setPerformOrderById, setSessionFactory, setUseScrollableResultSet, shutdown |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StatelessHibernateExternalDataSource
public StatelessHibernateExternalDataSource()
executeBulk
public void executeBulk(List<BulkItem> bulkItems)
throws DataSourceException
- Perform the given bulk changes using Hibernate
StatelessSession
. First, tries to perform
"optimistic" operations without checking in advance for existance of certain entity. If this fails, will
try and perform the same operations again, simply with checking if the entry exists or not.
- Specified by:
executeBulk
in interface BulkDataPersister
- Parameters:
bulkItems
- list of data object and the operation to apply on that object
- Throws:
DataSourceException
- when the data store fails to persist the given list of objects
iterator
public DataIterator iterator(SQLQuery sqlQuery)
throws DataSourceException
- Returns a
StatelessListQueryDataIterator
for the given
query.
- Specified by:
iterator
in interface SQLDataProvider
- Returns:
- a
DataIterator
or null if no data was found that match the given template
- Throws:
DataSourceException
initialLoad
public DataIterator initialLoad()
throws DataSourceException
- Performs the inital load operation. Iterates over the
AbstractHibernateExternalDataSource.setInitialLoadEntries(String[])
inital load
entries. If AbstractHibernateExternalDataSource.getInitialLoadChunkSize()
is set to -1
, will use
StatelessScrollableDataIterator
for each entity. If
AbstractHibernateExternalDataSource.getInitialLoadChunkSize()
is set to a non -1
value, will use the
StatelessChunkScrollableDataIterator
.
- Specified by:
initialLoad
in interface ManagedDataSource
- Returns:
- a
DataIterator
or null if no data should be loaded into space
- Throws:
DataSourceException
exists
protected boolean exists(Object entry,
org.hibernate.StatelessSession session)
Copyright © GigaSpaces.