GigaSpaces XAP 7.0 API

org.openspaces.persistency.patterns
Class SQLDataProviderExceptionHandler

java.lang.Object
  extended by org.openspaces.persistency.patterns.AbstractManagedDataSourceDelegator
      extended by org.openspaces.persistency.patterns.BulkDataPersisterExceptionHandler
          extended by org.openspaces.persistency.patterns.SQLDataProviderExceptionHandler
All Implemented Interfaces:
BulkDataPersister, ManagedDataSource, SQLDataProvider

public class SQLDataProviderExceptionHandler
extends BulkDataPersisterExceptionHandler
implements SQLDataProvider

Author:
kimchy

Field Summary
 
Fields inherited from class org.openspaces.persistency.patterns.BulkDataPersisterExceptionHandler
exceptionHandler
 
Fields inherited from class org.openspaces.persistency.patterns.AbstractManagedDataSourceDelegator
dataSource
 
Fields inherited from interface com.gigaspaces.datasource.ManagedDataSource
DATA_CLASS_PROPS, NUMBER_OF_PARTITIONS, STATIC_PARTITION_NUMBER
 
Constructor Summary
SQLDataProviderExceptionHandler(ManagedDataSource dataSource, ExceptionHandler exceptionHandler)
           
 
Method Summary
 DataIterator iterator(SQLQuery sqlQuery)
           Create an iterator over all objects that match the given SQLQuery.
 
Methods inherited from class org.openspaces.persistency.patterns.BulkDataPersisterExceptionHandler
executeBulk
 
Methods inherited from class org.openspaces.persistency.patterns.AbstractManagedDataSourceDelegator
init, initialLoad, 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, initialLoad, shutdown
 

Constructor Detail

SQLDataProviderExceptionHandler

public SQLDataProviderExceptionHandler(ManagedDataSource dataSource,
                                       ExceptionHandler exceptionHandler)
Method Detail

iterator

public DataIterator iterator(SQLQuery sqlQuery)
                      throws DataSourceException
Description copied from interface: SQLDataProvider
 Create an iterator over all objects that match the given SQLQuery.
 SQLQuery contains a string representation of SQL 'where' clause.
 The format matches the PreparedStatement format(field1 = ? and field2 > ? and ....).
 The prepared values are accessible by SQLQuery.getPreparedValues() method
 
 Example implementation with SQL PreparedStatement:
 
 
 PreparedStatement st = con.prepareStatement(query.getSelectAllQuery());
 
 int index = 0;
 
 if(query.hasPreparedValues())
 {
        for(Iterator iter = query.getPreparedValues().iterator();iter.hasNext())
        {
                st.setObject(++index,iter.next());
        }
 }
 
 ResultSet rs = st.executeQuery();
 
 return new ResultSetIterator(rs);
 
 

Specified by:
iterator in interface SQLDataProvider
Returns:
a DataIterator or null if no data was found that match the given template
Throws:
DataSourceException

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.