Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
DataMapper 1.6.2
-
None
-
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
// FixIBATISNET-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