Class SqlSessionResultHandler
java.lang.Object
com.nexacro.uiadapter17.jakarta.dao.mybatis.SqlSessionResultHandler
- All Implemented Interfaces:
org.apache.ibatis.session.ResultHandler<Object>
public class SqlSessionResultHandler
extends Object
implements org.apache.ibatis.session.ResultHandler<Object>
MyBatis를 사용하여 nexacro platform으로 대용량 데이터를 전송하려고 할때 사용되는 ResultHandler 이다.
iBatis의 SqlMapClient 기반의 SqlMapClientRowHandler를 MyBatis의 SqlSession 기반으로 대체한 클래스이다.
기존 `SqlMapClientRowHandler`의 모든 기능을 MyBatis 환경에서 동일하게 제공하며, 대용량 데이터를 분할하여 전송하는 기능을 그대로 지원한다.
아래와 같은 형식으로 queryWithRowHandler() 대신 select()로 처리한다. 쿼리가 실행한 후 남아 있는 데이터가 존재할 수 있기 때문에 전송되지 않은 데이터를 전송한다.
// 기존 iBatis - SqlMapClient 방식
SqlMapClientRowHandler rowHandler = new SqlMapClientRowHandler(firstRowHandler, sendName, firstRowCount);
getSqlMapClientTemplate().queryWithRowHandler("largeDataDAO.selectLargeData", null, rowHandler);
rowHandler.sendRemainData();
// 신규 MyBatis - SqlSession 방식
SqlSessionResultHandler rowHandler = new SqlSessionResultHandler(firstRowHandler, sendName, firstRowCount);
getSqlSession().select("largeDataDAO.selectLargeData", null, rowHandler);
rowHandler.sendRemainData();
- Since:
- 11.06.2025
- Version:
- 1.0
- Author:
- TechServ.
-
Constructor Summary
ConstructorsConstructorDescriptionSqlSessionResultHandler(com.nexacro.uiadapter17.jakarta.core.data.NexacroFirstRowHandler firstRowHandler, String resultName, int firstRowCount) Constructs an instance of SqlSessionResultHandler. -
Method Summary
Modifier and TypeMethodDescriptioncom.nexacro17.xapi.data.DataSetGets the current DataSet object.voidhandleResult(org.apache.ibatis.session.ResultContext<? extends Object> resultContext) Handles the processing of a result retrieved from a database query.void데이터 분할 전송 후 남아 있는 데이터를 전송한다.
-
Constructor Details
-
SqlSessionResultHandler
public SqlSessionResultHandler(com.nexacro.uiadapter17.jakarta.core.data.NexacroFirstRowHandler firstRowHandler, String resultName, int firstRowCount) Constructs an instance of SqlSessionResultHandler.- Parameters:
firstRowHandler- the handler responsible for processing the first rows of the result; it manages the data transfer and processing logicresultName- the name of the result to be used in creating the DataSetfirstRowCount- the configuration value indicating how many rows are initially processed; if the provided value is less than or equal to zero, a default value is used
-
-
Method Details
-
handleResult
Handles the processing of a result retrieved from a database query. This method processes the result object, prepares the DataSet, adds rows to it, and determines when to send a batch of rows for further processing. If any error occurs during the data preparation or processing, the method throws a specific exception.- Specified by:
handleResultin interfaceorg.apache.ibatis.session.ResultHandler<Object>- Parameters:
resultContext- the context containing the current result object from a database query, which is processed and added to a DataSet- Throws:
NexacroFirstRowException- if there is an error sending the data or converting an object into a DataSet
-
sendRemainData
public void sendRemainData()데이터 분할 전송 후 남아 있는 데이터를 전송한다. -
getDataSet
public com.nexacro17.xapi.data.DataSet getDataSet()Gets the current DataSet object.- Returns:
-