Parameter names issue in ParameterMap during calling Oracle Function
--------------------------------------------------------------------
Key: IBATISNET-292
URL: https://issues.apache.org/jira/browse/IBATISNET-292
Project: iBatis for .NET
Issue Type: Improvement
Components: DataMapper
Affects Versions: DataMapper 1.6.2
Environment: ODP - Oracle.DataAccess.dll (11.1), Oracle Instant Client
(11g)
Reporter: Ondrej Subrt
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
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.