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

Null in Oracle output parameter is not being converted to NullValue configured for a property in the parameterMap

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • DataMapper 1.6.1
    • None
    • DataMapper
    • None
    • WinXp, .Net 1.1, VS2003, Oracle ODP 9.2

    Description

      In the following configuration, I expected a PlmDocId property to be set to NullValue=-9999 but instead got the exception:
      "...
      IBatisNet.Common.Exceptions.IBatisNetException: Error executing query 'FlxProcessLogMap.Save' for insert. Cause: Object cannot be cast from DBNull to other types. ---> System.InvalidCastException: Object cannot be cast from DBNull to other types.
      at System.DBNull.System.IConvertible.ToInt64(IFormatProvider provider)
      at System.Convert.ToInt64(Object value)
      at IBatisNet.DataMapper.TypeHandlers.Int64TypeHandler.GetDataBaseValue(Object outputValue, Type parameterType)
      at IBatisNet.DataMapper.MappedStatements.MappedStatement.RetrieveOutputParameters(RequestScope request, ISqlMapSession session, IDbCommand command, Object result)
      at IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteInsert(ISqlMapSession session, Object parameterObject)
      ..."

      Configuration:

      <parameterMap id="SaveParameters" class="Hashtable">
      <parameter property="log.PlmDocId" direction="InputOutput" column="P_PLM_DOC_ID" dbType="Int64" type="long" nullValue="-9999"/>
      ...
      </parameterMap>

      Attachments

        Activity

          People

            Unassigned Unassigned
            anlesa Andrew Lion
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: