Re: ResultSet with ORACLE Stored Procedure OUT Parameter

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Jan 14 2005 - 13:59:03 EST

  • Next message: Jin Lee: "Cayenne, Tapestry, Tomcat plumbling"

    For maximum portability CayenneModeler uses JDBC standard types for
    mapping, being ignorant of vendor extentions. But OracleAdapter actually
    attempts to use OracleTypes.CURSOR when it recognizes it... I guess in
    this case it doesn't.

    Suggested workaround:

    // somewhere on app startup manually update the mapping...
    EntityResolver resolver =
       Configuration.getSharedConfiguration()
         .getDomain()
         .getEntityResolver();

    Procedure proc = resolver.lookupProcedure(procedureName);
    Iterator it = proc.getCallOutParameters().iterator();
    while(it.hasNext()) {
      ProcedureParameter param = (ProcedureParameter) it.next();
      if(param.getType() == Types.OTHER) {
         param.setType(OracleAdapter.getOracleCursorType());
      }
    }

    Please post a note how this worked... We may need to add a new feature to
    the Modeler to support vendor extentions (we have attribute prototypes
    feature request in JIRA, I guess this might go in there).

    Andrus

    OracleAdapter.getOracleCursorType()

    Andrus

    > Hi,
    > i'm a new Cayenne's user.
    > I have a Oracle stored procedure that return a CURSOR by OUT parmeter.
    > With Cayenne Modeler i have generated a datamap xml file:
    >
    > <procedure name="USERLOGIN" schema="xxxx" catalog="xxxx"
    > returningValue="true">
    > <procedure-parameter name="I_S_USER_ALIAS" type="VARCHAR"
    > direction="in"/>
    > <procedure-parameter name="O_RC_USERINFO" type="OTHER"
    > direction="out"/> <procedure-parameter name="O_N_EXITFLAG"
    > type="DECIMAL" length="22" direction="out"/>
    > <procedure-parameter name="O_S_EXITMSG" type="VARCHAR"
    > direction="out"/>
    > </procedure>
    >
    > O_RC_USERINFO is a REF CURSOR that i want to map to my java Object.
    >
    > I try to access to stored procedure in that way:
    >
    >
    > DataContext ctxt = DataContext.createDataContext();>
    > ProcedureQuery query = new ProcedureQuery("USERLOGIN");
    > query.addParameter("I_S_USER_ALIAS", "smith");
    > List outList = ctxt.performQuery(query);
    >
    >
    > when i execute the last line (List outList = ctxt.performQuery(query);)
    > i found that error:
    >
    > INFO QueryLogger: *** error.
    > java.sql.SQLException: Invalid column type
    >
    > the problem is referred to the "OTHER" type that is associated to my
    > REF CURSOR.
    >
    > Anyone can help me?
    >
    > Usually, with JDBC, i use OracleTypes.CURSOR to retrive data from
    > this REF CURSOR. Why Cayenne Modeler use "OTHER" type instead?
    >
    >
    > Thank's.
    >
    > D.



    This archive was generated by hypermail 2.0.0 : Fri Jan 14 2005 - 13:59:05 EST