ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jesse Reimann" <jreim...@ctigroup.com>
Subject RE: Re: Question about queryForList and Oracle ref cursors
Date Tue, 11 Mar 2008 14:08:10 GMT
Ok thanks to everyone for the info. I've switched over to using the
update method since it is the correct usage. I thought it might be
something like that but wasn't sure since I was able to use queryForList
when passing in the HashMap. I did notice as Sundar mentioned that with
the HashMap you are able to support multiple returned result sets which
is a really nice feature that I know I'll be taking advantage of in the
future.

 

Thanks,

 

Jesse

 

________________________________

From: Jeff Butler [mailto:jeffgbutler@gmail.com] 
Sent: Monday, March 10, 2008 9:59 PM
To: user-java@ibatis.apache.org
Subject: Re: Re: Question about queryForList and Oracle ref cursors

 

queryForList only works for things that return result sets.  Oracle ref
cursors are a "sort of" result set, but the ref cursor is a parameter to
a callable statement, rather than being returned from the stored proc.
This is an important difference.

 

Because of this, iBATIS (and JDBC) sees them as parameters - just a
wierd type of parameter.  This is why the queryForXXX methods don't play
well with ref cursors - so yes, the update method is the best method to
use here.

 

Jeff Butler

On Mon, Mar 10, 2008 at 8:13 PM, Jason Bennett
<Jason.Bennett@3nonline.com> wrote:

One problem I had in this scenario is when I pass parameters to the
function, and expect a cursor back. I had to map the returning
parameter, since I had mapped all the in parameters. This prevented me
from using queryForList() as I wanted to. Am I doing anything wrong, or
does passing parameters to the SP force me to use the update() method?

 

                        jason

 

________________________________

From: Ryan Shelley [mailto:12gaugemedia@gmail.com] 
Sent: Monday, March 10, 2008 2:38 PM 


To: user-java@ibatis.apache.org
Subject: Re: Re: Question about queryForList and Oracle ref cursors

 

For reference:

http://opensource.atlassian.com/confluence/oss/display/IBATIS/How+do+I+c
all+a+stored+procedure

Under: What SqlMapClient Method Should I Use?
...
If your procedure returns a result set (not a result set in an OUT
parameter, but a result set from the procedure itself), then use
queryForList() or queryForObject(). Use queryForList() if you expect
more than one result object, or queryForObject() if you expect only one
result Object.
...
If your procedure does not return result sets, or only returns result
sets in OUT parameters, then use the update() method.

-Ryan

On Mon, Mar 10, 2008 at 2:22 PM, Ryan Shelley <12gaugemedia@gmail.com>
wrote:

In the one you had, you were creating an empty HashMap, executing the
queryForList method passing in the empty HashMap, and then converting
the still empty HashMap to a list and returning that to your method.
queryForList doesn't take an object parameter to store the results in,
it takes an object parameter to pass variables into your queries.  The
return value of queryForList is a List of your ResultMapped Models.

-Ryan

 

On Mon, Mar 10, 2008 at 2:06 PM, Jesse Reimann <jreimann@ctigroup.com>
wrote:

Ryan that's exactly what I did that wouldn't work. It returns to me a
List that has 10 elements all which are NULL.
 
 
 
 
Jesse

 

 

 

 


Mime
View raw message