ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: Stored procedures (package functions) returning a row
Date Tue, 03 Oct 2006 14:32:00 GMT
The developer's guide does refer you to the CallableStatement documentation
- and that is where the proper syntax is detailed (because it is standard
syntax in JDBC).  iBATIS isn't doing anything magical, it is a fairly thin
wrapper over JDBC.  So some JDBC knowledge will help a lot.

http://java.sun.com/j2se/1.4.2/docs/api/java/sql/CallableStatement.html

Jeff Butler


On 10/3/06, C.Zecca@ads.it <C.Zecca@ads.it> wrote:
>
>  "Jeff Butler" <jeffgbutler@gmail.com> scritti il 03/10/2006 14:59:55
>
> > There are two different issues here.
>
> [...]
>
> > 2. Only use queryForObject if the function returns a result set.  If
> > it is just returning a single value, then call it with syntax like this:
> >
> > {? = call myFunction}
> >
> > Register an output parameter - not a resultMap - then call it with
> > the "update" method.
>
> I will investigate asap the doc and the list for the suggested approach
> (a search about "output parameter" and "? =" in the pdf Developer guide
> has just reported no occurrences :/)
> Anyway, please note that the returned value is actually a record type (a
> "row").
> I hope that it's possible to get, via output parameters, not only simple
> SQL types but record types (rows) as well.
>
>
> > Unfortunatley, the iBATIS stored procedure support is hard to
> > understand - it makes sense if you really understand JDBC, but
> > probably doesn't otherwise.  The most important thing to remember is
> > this - when iBATIS uses the term "result" (resultMap, resultClass,
> > etc.) it ALWAYS refers to a result set.  A single value returned
> > from a procedure or function is NOT a result in iBATIS - it is an
> > output parameter.
>
> Right, Jeff!
> I have no experience (or very little) about JDBC.
> I trusted some critics and colleagues that suggest iBatis because "very
> useful
> to approach a DB from Java code without concern for many tedious details
> that you have to face with direct
> programming of JDBC".
> Does it help (I mean for teh documentation)? I mean that ... there is one
> user, at least, that directly passed JDBC by.
> :)
>
>
> Let'me experiment.
> I will report any result as soon as possible
>
> ciao
>

Mime
View raw message