GigaSpaces - Open Spaces

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:
com.gigaspaces.datasource.BulkDataPersister, com.gigaspaces.datasource.ManagedDataSource, com.gigaspaces.datasource.SQLDataProvider, ManagedDataSourceEntriesProvider

public class StatelessHibernateExternalDataSource
extends AbstractHibernateExternalDataSource
implements com.gigaspaces.datasource.BulkDataPersister, com.gigaspaces.datasource.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

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<com.gigaspaces.datasource.BulkItem> bulkItems)
          Perform the given bulk changes using Hibernate StatelessSession.
protected  boolean exists(Object entry, org.hibernate.StatelessSession session)
           
 com.gigaspaces.datasource.DataIterator initialLoad()
          Performs the inital load operation.
 com.gigaspaces.datasource.DataIterator iterator(com.j_spaces.core.client.SQLQuery sqlQuery)
          Returns a StatelessListQueryDataIterator for the given query.
 
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
 
Methods inherited from interface com.gigaspaces.datasource.ManagedDataSource
init, shutdown
 

Constructor Detail

StatelessHibernateExternalDataSource

public StatelessHibernateExternalDataSource()
Method Detail

executeBulk

public void executeBulk(List<com.gigaspaces.datasource.BulkItem> bulkItems)
                 throws com.gigaspaces.datasource.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 com.gigaspaces.datasource.BulkDataPersister
Throws:
com.gigaspaces.datasource.DataSourceException

iterator

public com.gigaspaces.datasource.DataIterator iterator(com.j_spaces.core.client.SQLQuery sqlQuery)
                                                throws com.gigaspaces.datasource.DataSourceException
Returns a StatelessListQueryDataIterator for the given query.

Specified by:
iterator in interface com.gigaspaces.datasource.SQLDataProvider
Throws:
com.gigaspaces.datasource.DataSourceException

initialLoad

public com.gigaspaces.datasource.DataIterator initialLoad()
                                                   throws com.gigaspaces.datasource.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 getInitalLoadChunkSize () is set to a non -1 value, will use the StatelessChunkScrollableDataIterator.

Specified by:
initialLoad in interface com.gigaspaces.datasource.ManagedDataSource
Throws:
com.gigaspaces.datasource.DataSourceException

exists

protected boolean exists(Object entry,
                         org.hibernate.StatelessSession session)

GigaSpaces - Open Spaces

Copyright © GigaSpaces.