Uploaded image for project: 'iBatis for .NET'
  1. iBatis for .NET
  2. IBATISNET-292

RetrieveOutputParameters throws NullReferenceException during calling Oracle Function (with output param)

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • DataMapper 1.6.2
    • None
    • DataMapper
    • None
    • ODP - Oracle.DataAccess.dll (11.1), Oracle Instant Client (11g)

    Description

      PROBLEM:
      NullReferenceException is thrown when trying to query:

      <statement id="sRecvTran" parameterMap="pRecvTran">
      BEGIN :rTransferData := MEX.MEX_PROC.NactiTransfer(:pTransferId, 'cdcc08a412bbccab2b6c6eee27e7de1db3939d32', NULL); END;
      </statement>

      <parameterMap id="pRecvTran">
      <parameter property="Data" dbType="Clob" direction="Output" />
      <parameter property="TransferId" direction="Input" />
      </parameterMap>

      REASON:
      In MappedStatement.RetrieveOutputParameters() is used this to contruct parameter name:
      parameterName = session.DataSource.DbProvider.ParameterPrefix + mapping.ColumnName;

      But ColumnName is NULL or equals to column attribute in parameter element. There is problem:

      • parameter name in statement element is rTransferData
      • column name in parameter element is NULL or "rTransferData" (when setting column attribute)
      • parameterName in code is ":" or ":rTransferId" but in command.Parameters array is ":param0"
        --> Output parameter is therefore NULL an then when
        // Fix IBATISNET-239
        //"Normalize" System.DBNull parameters
        IDataParameter dataParameter = (IDataParameter)command.Parameters[parameterName];
        !!! Exception !!! object dbValue = dataParameter.Value;

      SOLUTION:

      • wrtite to docs, that column attribute has to be only "paramN"
      • search output parameters also by column name attribute

      Attachments

        Activity

          People

            Unassigned Unassigned
            subrto Ondrej Subrt
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: