Index: /Users/louis/Documents/workspace/compass/src/main/src/org/compass/gps/device/ibatis/SqlMapClientGpsDevice.java
===================================================================
--- /Users/louis/Documents/workspace/compass/src/main/src/org/compass/gps/device/ibatis/SqlMapClientGpsDevice.java (revision 2306)
+++ /Users/louis/Documents/workspace/compass/src/main/src/org/compass/gps/device/ibatis/SqlMapClientGpsDevice.java (working copy)
@@ -26,6 +26,7 @@
import com.ibatis.common.util.PaginatedList;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapSession;
+import com.ibatis.sqlmap.client.event.RowHandler;
/**
* A SqlMapClient device, provides support for iBatis 2 and the
@@ -35,12 +36,9 @@
* The device must be initialized with a SqlMapClient instance.
* When indexing the data, a SqlMapSession will be opened, and a
* transaction will be started. The device will then execute the select
- * statement id, and use the iBatis PaginatedList to index the
+ * statement id, and use the iBatis RowHandler to index the
* data.
*
PaginatedList can be controlled using
- * the pageSize property.
- *
* The select statment can have a parameter object associated with it. If one of
* the select statements requires a parameter object, than the
* statementsParameterObjects property must be set. It must have
@@ -114,18 +112,17 @@
if (statementsParameterObjects != null) {
parameterObject = statementsParameterObjects[i];
}
- PaginatedList paginatedList = sqlMapSession.queryForPaginatedList(selectStatementsIds[i],
- parameterObject, pageSize);
- do {
- if (log.isDebugEnabled()) {
- log.debug(buildMessage("Indexing select statement id [" + selectStatementsIds[i]
- + "] page [" + paginatedList.getPageIndex() + "]"));
- }
- for (Iterator it = paginatedList.iterator(); it.hasNext();) {
- session.create(it.next());
- }
- session.evictAll();
- } while (paginatedList.nextPage());
+ if (log.isDebugEnabled()) {
+ log.debug(buildMessage("Indexing select statement id [" + selectStatementsIds[i]
+ + "]"));
+ }
+ final CompassSession _session = session;
+ sqlMapSession.queryWithRowHandler(selectStatementsIds[i],
+ parameterObject, new RowHandler(){
+ public void handleRow(Object valueObject) {
+ _session.create(valueObject);
+ _session.evictAll();
+ }});
sqlMapSession.commitTransaction();
} catch (SQLException e) {
throw new SqlMapGpsDeviceException("Failed to fetch paginated list for statement ["
@@ -156,6 +153,9 @@
this.selectStatementsIds = statementsNames;
}
+ /**
+ * @deprecated
+ */
public int getPageSize() {
return pageSize;
}
@@ -160,6 +160,9 @@
return pageSize;
}
+ /**
+ * @deprecated
+ */
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}