ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: does ibatis support oracle cursor
Date Thu, 23 Dec 2004 17:26:27 GMT
Gus,

I didn't realize you were trying to do this through an OUT parameter. 
Unfortunately custom type handlers don't yet work with output
parameters.  You might be better off just using straight JDBC for this
one....as is often the case with vendor specific APIs.

Cheers,
Clinton

On Thu, 23 Dec 2004 20:35:40 +0800, gus wang <Gus.Wang@sun.com> wrote:
>   Dear Clinton,
> 
> I would really appreciate you going one step further to help out. How
> can I do the equivalent of
> 
> aCallableStatement.registerOutParameter(4,oracle.jdbc.OracleTypes.CURSOR ) in iBatis
when it is a stored procedure???
> 
>         <parameterMap id="GetDocManagerParam" class="java.util.Map" >
>                 <parameter property="p_hr_deptno" jdbcType="VARCHAR" javaType="java.lang.String"
mode="IN"/>
>                 <parameter property="p_tasksortid" jdbcType="VARCHAR" javaType="java.lang.String"
mode="IN"/>
>                 <parameter property="p_opt_range" jdbcType="OBJECT" javaType="java.lang.Object"
mode="IN"/>
> <!-- ?????????? HOW DO I WRITE THIS LINE BELOW ?????????? -->
>                 <parameter property="docmanagerlist" typeHandler="OracleCursorTypeHandler"
/>
>         </parameterMap>
> 
>         <procedure id="GET-PRIV-DOC-DOCMANAGER" parameterMap="GetDocManagerParam">
>                 <![CDATA[
>                         begin
>                                 eoffice.GetDocManager(?,?,?,?);
>                         end;
>                 ]]>
>         </procedure>
> 
> --------------------------- in jdbc, it would have been
> -------------------------------------
> 
> java.sql.Connection conn = null;
>       java.sql.CallableStatement cstmt = null;
>       java.sql.ResultSet rs = null;
> 
>       try {
>         conn = getConnection();
>         String sql = "{call eoffice.GetDocManager(?,?,?,?)}";
> 
>         cstmt = conn.prepareCall(sql);
>         cstmt.setString(1,compId);
>         cstmt.setString(2,docType);
>         cstmt.setString(3,flag);
>         cstmt.registerOutParameter(4,oracle.jdbc.OracleTypes.CURSOR );
>         cstmt.executeQuery();
> 
>         rs = (java.sql.ResultSet)cstmt.getObject(4);
> 
> 
> Clinton Begin wrote:
> 
> >Not directly, as it's a database specific type.  You can create a
> >custom type handler and use ResultSet getObject() to get the cursor.
> >You must use the cursor completely within the type handler, as all
> >resources are closed by the end of the execution.
> >
> >Clinton
> >
> >
> >On Thu, 09 Dec 2004 15:11:32 +0800, Gus Wang <Gus.Wang@sun.com> wrote:
> >
> >
> >>Hi,
> >>
> >>Does iBatis have support for Oracle stored procedure when the return
> >>is a cursor (resultset)? How if yes? In JDBC, this is supported thru
> >>oracle.jdbc.OracleTypes.CURSOR? Thanks in advance!
> >>
> >>Gus Wang
> >>13570700773
> >>Java Architect
> >>Enterprise Web Services
> >>Sun
> >>
> >>
> >>
> 
> --
> Gus Wang
> 13570700773
> Senior Solution Architect
> Enterprise Web Services
> CSO, Sun China
> 
>

Mime
View raw message