ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Javier Leyba" <xle...@gmail.com>
Subject Re: Parameters to store procedure
Date Mon, 04 Sep 2006 08:46:55 GMT
On 9/2/06, Jeff Butler <jeffgbutler@gmail.com> wrote:
>
> iBATIS resultMap/resultClass objects are only used for result sets.  Since
> your procedure does not return a result set, they will not work.
>
> In your case, since you are using a Map as a parameter object, the result
> should be available in the Map after you call the procedure.
>
>


Hi

Thanks for your reply.

I've changed my map to this:

---------------
<procedure id="deleteUserNotification" parameterClass="java.util.Map">
                <![CDATA[
                {call
deleteUserNotification(#usedId#,#notificationId#,#result#)}
        ]]>
 </procedure>
--------------


In my program I did:

-------------
// to check if I'm receiving parameters ok.
if (logger.isDebugEnabled()) {
	logger.debug("---- deleteUserNotification(String, Integer)");
	logger.debug("---- userId: 			" + userId);
	logger.debug("---- notificationId: 	" + notificationId);
	logger.debug("------------------------------------------");
}

SqlMapClient sqlMap = NotificationsSqlConfig.getSqlMapInstance();
Map m = new HashMap();
m.put("userId", userId);
m.put("notificationId", notificationId);
m.put("result", null);
Map qm = sqlMap.queryForMap("deleteUserNotification", m, "result");
			
logger.info("---- qm: " + qm.toString());	

--------------------------

Then in my log I can see my program received parameters ok:

-------------
2006-09-04 10:34:00,324 :INFO
:[http-0.0.0.0-8088-1]:sPortSoapBindingImpl:
deleteUserNotification(String, Integer) - start
2006-09-04 10:34:00,325 :DEBUG
:[http-0.0.0.0-8088-1]:sPortSoapBindingImpl: ----
deleteUserNotification(String, Integer)
2006-09-04 10:34:00,326 :DEBUG
:[http-0.0.0.0-8088-1]:sPortSoapBindingImpl: ---- userId: javier
2006-09-04 10:34:00,327 :DEBUG
:[http-0.0.0.0-8088-1]:sPortSoapBindingImpl: ---- notificationId:
  1
2006-09-04 10:34:00,327 :DEBUG
:[http-0.0.0.0-8088-1]:sPortSoapBindingImpl:
------------------------------------------

--------------


but I enabled ibatis.sql.debug and I see the following:

-----------------------
2006-09-04 10:34:01,713 :DEBUG
:[http-0.0.0.0-8088-1]:taCommonsLoggingImpl: {pstm-100001} Executing
Statement: {call deleteUserNotification(?,?,?)}
2006-09-04 10:34:01,743 :DEBUG
:[http-0.0.0.0-8088-1]:taCommonsLoggingImpl: {pstm-100001} Parameters:
[null, 1, null]
2006-09-04 10:34:01,744 :DEBUG
:[http-0.0.0.0-8088-1]:taCommonsLoggingImpl: {pstm-100001} Types:
[null, java.lang.Integer, null]
---------------------------


where parameters appear as null values...

The query keeps doing nothing and my client program waiting for a
reply without success...

My store procedure is:

--------
CREATE PROCEDURE `DeleteUserNotification`(sUserId VARCHAR(255),
iNotificationId INTEGER(11), OUT result INTEGER(11))
    NOT DETERMINISTIC
    SQL SECURITY INVOKER
    COMMENT ''
BEGIN
     DELETE FROM user_notification
     WHERE user_notification.notification_id = sUserId
     AND user_notification.user_id = iNotificationId;

     SELECT ROW_COUNT() into result;
END;
-----------


and it work well from a SQL console...


What´s wrong ?

Thanks in advance



-- 
Javier Leyba
Barcelona - Spain
http://blog.leyba.com.ar

Mime
View raw message