camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ramon van den Hoven (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CAMEL-3066) Result is empty after calling a stored procedure
Date Mon, 30 Aug 2010 12:42:40 GMT

    [ https://issues.apache.org/activemq/browse/CAMEL-3066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61504#action_61504
] 

Ramon van den Hoven commented on CAMEL-3066:
--------------------------------------------

I solved it this way:

I added a key value pair in the parameterMap.
(key=outParamName, value=<the key of the out parameter)
this way I know what the out parameter is.
I don't believe it's a very nice solution but, it works for me right now



 private void doQueryForObject(Exchange exchange) throws Exception {
        SqlMapClient client = endpoint.getSqlMapClient();

        Object result;
        Object in = exchange.getIn().getBody();
        if (in != null) {
            if (LOG.isTraceEnabled()) {
                LOG.trace("QueryForObject: " + in + "  using statement: " + statement);
            }
            result = client.queryForObject(statement, in);
            
            if (result == null){
            	if (in instanceof Map){
            		Map m = ((Map)in);
            		result = m.get(m.get("outParamName"));
            	}
            }
            
            
        } else {
            if (LOG.isTraceEnabled()) {
                LOG.trace("QueryForObject using statement: " + statement);
            }
            result = client.queryForObject(statement);
        }

        doProcessResult(exchange, result);
    }

> Result is empty after calling a stored procedure
> ------------------------------------------------
>
>                 Key: CAMEL-3066
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3066
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-ibatis
>    Affects Versions: 2.4.0
>         Environment: Windows, eclipse, oracle
>            Reporter: Ramon van den Hoven
>
> When calling a stored procedure in the following form {call lsuser.liq_vortex.LIQ_VORTEX_ALL_STRUCT(?,?,?,?,?)}
where the last ? is an OUT param, the result is null.
> See for comments in the following function in the  IbatisProducer class
> Look for the NOTE:
> private void doQueryForObject(Exchange exchange) throws Exception {
>         SqlMapClient client = endpoint.getSqlMapClient();
>         Object result;
>         Object in = exchange.getIn().getBody();
>         if (in != null) {
>             if (LOG.isTraceEnabled()) {
>                 LOG.trace("QueryForObject: " + in + "  using statement: " + statement);
>             }
>             result = client.queryForObject(statement, in);
> NOTE: The in parameter has the resultset, in my case a HashMap, isn't it always a Map?
> should be something like:
>         result = in.get(outParameterKey)
>         } else {
>             if (LOG.isTraceEnabled()) {
>                 LOG.trace("QueryForObject using statement: " + statement);
>             }
>             result = client.queryForObject(statement);
>         }
>         doProcessResult(exchange, result);
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message