mybatis resultHandler doesn;t get invoke for Oracle db stored procedure

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

mybatis resultHandler doesn;t get invoke for Oracle db stored procedure

Detali
Mybatis ResultHandler type for Oracle stored procedure is not working . its work for normal select query like (Select column name from table)
I have tried using @resultMap and below example . any help in this matter really helpful.

Select("{call sp_getPosition( #{PLATFORM, mode=IN, jdbcType=CHAR},

#{c_arrPos, mode=OUT, jdbcType=CURSOR, javaType=java.sql.ResultSet,resultMap=arrPos})})

@Options(statementType = StatementType.CALLABLE) public void getPosition(Map parameter);

/*DAO */
@Override public void getPosition (String platform)
 {
CustomResultHandler rsArrPosCalc = new CustomResultHandler();
Map paramMap = new HashMap();
paramMap.put("PLATFORM", platform);
paramMap.put("c_arrPos", rsArrPosCalc);
getDataMapper().getPosition(paramMap);
}

/*CustomResultHandler class*/
public class CustomResultHandler implements ResultHandler {

private ArrayList<Object> recordList;

public void handleResult(ResultContext resultContext)
{

recordList.add((Object) resultContext.getResultObject());

if(recordList.size() == MAX_COUNT)

{ recordList.clear();

}
}

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: mybatis resultHandler doesn;t get invoke for Oracle db stored procedure

Iwao AVE!
Hi Deepak,

The fix has been committed, but not released yet.
It would be great if you could verify the fix with 3.4.6-SNAPSHOT.

Note that the result handler instance must be passed as an independent parameter to your mapper method.
i.e. Instead of...

public void getPosition(Map parameter); 

it has to be...

public void getPosition(Map parameter, ResultHandler handler); 

Please see the test case as an example.

Regards,
Iwao

2018-02-03 1:38 GMT+09:00 Detali <[hidden email]>:
Mybatis ResultHandler type for Oracle stored procedure is not working . its work for normal select query like (Select column name from table)
I have tried using @resultMap and below example . any help in this matter really helpful.

Select("{call sp_getPosition( #{PLATFORM, mode=IN, jdbcType=CHAR},

#{c_arrPos, mode=OUT, jdbcType=CURSOR, javaType=java.sql.ResultSet,resultMap=arrPos})})

@Options(statementType = StatementType.CALLABLE) public void getPosition(Map parameter);

/*DAO */
@Override public void getPosition (String platform)
 {
CustomResultHandler rsArrPosCalc = new CustomResultHandler();
Map paramMap = new HashMap();
paramMap.put("PLATFORM", platform);
paramMap.put("c_arrPos", rsArrPosCalc);
getDataMapper().getPosition(paramMap);
}

/*CustomResultHandler class*/
public class CustomResultHandler implements ResultHandler {

private ArrayList<Object> recordList;

public void handleResult(ResultContext resultContext)
{

recordList.add((Object) resultContext.getResultObject());

if(recordList.size() == MAX_COUNT)

{ recordList.clear();

}
}

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.