GigaSpaces XAP 9.0 API

org.openspaces.persistency.hibernate
Class StatelessHibernateExternalDataSource

java.lang.Object
  extended by org.openspaces.persistency.hibernate.AbstractHibernateExternalDataSource
      extended by org.openspaces.persistency.hibernate.StatelessHibernateExternalDataSource
All Implemented Interfaces:
BulkDataPersister, ManagedDataSource, SQLDataProvider, ManagedDataSourceEntriesProvider

public class StatelessHibernateExternalDataSource
extends AbstractHibernateExternalDataSource
implements BulkDataPersister, SQLDataProvider

An external data source implementation 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

Field Summary
 
Fields inherited from class org.openspaces.persistency.hibernate.AbstractHibernateExternalDataSource
HIBERNATE_CFG_PROPERTY, logger
 
Fields inherited from interface com.gigaspaces.datasource.ManagedDataSource
DATA_CLASS_PROPS, NUMBER_OF_PARTITIONS, STATIC_PARTITION_NUMBER
 
Constructor Summary
StatelessHibernateExternalDataSource()
           
 
Method Summary
 void executeBulk(List<BulkItem> bulkItems)
          Perform the given bulk changes using Hibernate StatelessSession.
protected  boolean exists(BulkItem bulkItem, org.hibernate.StatelessSession session)
           
 DataIterator initialLoad()
          Performs the initial load operation.
 DataIterator iterator(SQLQuery sqlQuery)
          Returns a StatelessListQueryDataIterator for the given query.
 
Methods inherited from class org.openspaces.persistency.hibernate.AbstractHibernateExternalDataSource
createInitialLoadIterator, filterItemValue, getFetchSize, getInitialLoadChunkSize, getInitialLoadEntries, getManagedEntries, getPartialUpdateHQL, getSessionFactory, init, isManaged, 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
 
Methods inherited from interface com.gigaspaces.datasource.ManagedDataSource
init, shutdown
 

Constructor Detail

StatelessHibernateExternalDataSource

public StatelessHibernateExternalDataSource()
Method Detail

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 existence 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 initial 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(BulkItem bulkItem,
                         org.hibernate.StatelessSession session)

GigaSpaces XAP 9.0 API

Copyright © GigaSpaces.