You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Ramon van den Hoven (JIRA)" <ji...@apache.org> on 2010/08/20 16:37:47 UTC

[jira] Created: (CAMEL-3066) Result is empty after calling a stored procedure

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.


[jira] Updated: (CAMEL-3066) Result is empty after calling a stored procedure

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-3066?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-3066:
-------------------------------

    Issue Type: Improvement  (was: Bug)
      Priority: Minor  (was: Major)

> 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: Improvement
>          Components: camel-ibatis
>    Affects Versions: 2.4.0
>         Environment: Windows, eclipse, oracle
>            Reporter: Ramon van den Hoven
>            Priority: Minor
>
> 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.


[jira] Commented: (CAMEL-3066) Result is empty after calling a stored procedure

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-3066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61623#action_61623 ] 

Claus Ibsen commented on CAMEL-3066:
------------------------------------

You can always extra that last Map element in a processor afterwards

{code}
from("xxx")
   .to("ibatis:xxx")
   .process(new MyExtractStoredProcedureResult());
{code}

I don't see this as a bug, because Camel returns the result that iBatis returned back. And hence Camel should not try to _alter_ that response.

> 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.


[jira] Commented: (CAMEL-3066) Result is empty after calling a stored procedure

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-3066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61471#action_61471 ] 

Claus Ibsen commented on CAMEL-3066:
------------------------------------

Ramon do you care to follow up on this and help out?

> 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.


[jira] Commented: (CAMEL-3066) Result is empty after calling a stored procedure

Posted by "Ramon van den Hoven (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Resolved: (CAMEL-3066) Result is empty after calling a stored procedure

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-3066?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-3066.
--------------------------------

         Assignee: Claus Ibsen
    Fix Version/s: 2.5.0
       Resolution: Working as Designed

> 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: Improvement
>          Components: camel-ibatis
>    Affects Versions: 2.4.0
>         Environment: Windows, eclipse, oracle
>            Reporter: Ramon van den Hoven
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.5.0
>
>
> 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.


[jira] Commented: (CAMEL-3066) Result is empty after calling a stored procedure

Posted by "Ramon van den Hoven (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-3066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61500#action_61500 ] 

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

Yes sorry, I was on holiday for a week.
It's hard to create a unit test for this one, since it connects to an oracle database.
I'm questioning if it is a camel issue, maybe it's a ibatis issue;


The statement: 
result = client.queryForObject(statement, in);
expects a statement: in my case a stored procedure:
{call lsuser.liq_vortex.LIQ_VORTEX_ALL_STRUCT(?,?,?,?,?)} 
The in parameter is a Map, where I defined the input parameters for the stored procedure
The last parameter in the Map is the out parameter. So my results are in the Map indeed and not in the return value of the method.
This way no results will be passed on in the camel route.
I will try to create a simple project.










> 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.


[jira] Commented: (CAMEL-3066) Result is empty after calling a stored procedure

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-3066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61316#action_61316 ] 

Claus Ibsen commented on CAMEL-3066:
------------------------------------

So you are saying the result from the {{client.queryForObject}} operation is a Map of some sort.

In which there is an OUT param (in that Map) and you want the camel-ibatis component to figure this out, and take out that OUT param and use as the result?

Can you put together a small example project / unit test we can use for unit testing?

> 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.


[jira] Commented: (CAMEL-3066) Result is empty after calling a stored procedure

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-3066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61502#action_61502 ] 

Claus Ibsen commented on CAMEL-3066:
------------------------------------

Ramon, thanks for reporting back.

How do you map the last parameter as OUT? How do you tell iBatis that it's an OUT parameter?

> 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.