GigaSpaces - Open Spaces

org.openspaces.persistency.hibernate
Class DefaultHibernateExternalDataSource

java.lang.Object
  extended by org.openspaces.persistency.hibernate.AbstractHibernateExternalDataSource
      extended by org.openspaces.persistency.hibernate.DefaultHibernateExternalDataSource
All Implemented Interfaces:
com.gigaspaces.datasource.BulkDataPersister, com.gigaspaces.datasource.ManagedDataSource, com.gigaspaces.datasource.SQLDataProvider, ManagedDataSourceEntriesProvider
Direct Known Subclasses:
CriteriaHibernateExternalDataSource

public class DefaultHibernateExternalDataSource
extends AbstractHibernateExternalDataSource
implements com.gigaspaces.datasource.BulkDataPersister, com.gigaspaces.datasource.SQLDataProvider

The default Hiberante external data source implementation. Based on Hibernate Session.

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
DefaultHibernateExternalDataSource()
           
 
Method Summary
 void executeBulk(List<com.gigaspaces.datasource.BulkItem> bulkItems)
          Perform the given bulk changes using Hibernate Session.
 com.gigaspaces.datasource.DataIterator initialLoad()
          Performs the initial load operation.
 com.gigaspaces.datasource.DataIterator iterator(com.j_spaces.core.client.SQLQuery sqlQuery)
          Returns a DefaultListQueryDataIterator for the given sql query.
 void setUseMerge(boolean useMerge)
          If set to true, will use Hiberante merge to perform the create/update, and will merge before calling delete.
 
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

DefaultHibernateExternalDataSource

public DefaultHibernateExternalDataSource()
Method Detail

setUseMerge

public void setUseMerge(boolean useMerge)
If set to true, will use Hiberante merge to perform the create/update, and will merge before calling delete. This might be required for complex mappings (depends on Hibernate) at the expense of slower performance. Defaults to false.


executeBulk

public void executeBulk(List<com.gigaspaces.datasource.BulkItem> bulkItems)
                 throws com.gigaspaces.datasource.DataSourceException
Perform the given bulk changes using Hibernate Session.

Note, this implementation relies on Hibernate NonUniqueObjectException in case the entity is already associated with the given session, and in such a case, will result in performing merge operation (which is more expensive).

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 DefaultListQueryDataIterator for the given sql 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 initial load operation. Iterates over the AbstractHibernateExternalDataSource.setInitialLoadEntries(String[]) inital load entries. If AbstractHibernateExternalDataSource.getInitialLoadChunkSize() is set to -1, will use DefaultScrollableDataIterator for each entity. If getInitalLoadChunkSize () is set to a non -1 value, will use the DefaultChunkScrollableDataIterator.

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

GigaSpaces - Open Spaces

Copyright © GigaSpaces.