org.openspaces.persistency.patterns
Class SQLDataProviderExceptionHandler
java.lang.Object
org.openspaces.persistency.patterns.AbstractManagedDataSourceDelegator
org.openspaces.persistency.patterns.BulkDataPersisterExceptionHandler
org.openspaces.persistency.patterns.SQLDataProviderExceptionHandler
- All Implemented Interfaces:
- BulkDataPersister, ManagedDataSource, SQLDataProvider
public class SQLDataProviderExceptionHandler
- extends BulkDataPersisterExceptionHandler
- implements SQLDataProvider
- Author:
- kimchy
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SQLDataProviderExceptionHandler
public SQLDataProviderExceptionHandler(ManagedDataSource dataSource,
ExceptionHandler exceptionHandler)
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
Copyright © GigaSpaces.