You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Jason Finch <jf...@emergency.qld.gov.au> on 2006/04/18 07:04:58 UTC

Trouble with Null Ints from select stored proc query.

Dear all,

I've just started using iBatis.net and am having troubles with getting
null ints from a stored proc.
The stored proc is returning Nulls for each of the columns, verified by
executing in sql.  The database is a SQL 2000 server.

When I look at the populated classes the field values are all 0.  I've
attempted to make -1 the magic number for nulls by setting nullValue="-1
in the resultMap.
At this stage I am only selecting values, no inserting/updating.   Am i
missing something?

(I am running on SVN build 393142)



My Resultmap looks like this:
<resultMap id="TargetMatrixResult" class="TargetMatrix">
 <result property="Target1" column="Target1" dbType="Int32"
nullValue="-1"/>
   <result property="Target2" column="Target2" dbType="Int32"
nullValue="-1"/>
   <result property="Target3" column="Target3" dbType="Int32"
nullValue="-1"/>
   <result property="Target4" column="Target4" dbType="Int32"
nullValue="-1"/>
   <result property="Target5" column="Target5" dbType="Int32"
nullValue="-1"/>
   <result property="Target6" column="Target6" dbType="Int32"
nullValue="-1"/>
   <result property="Target7" column="Target7" dbType="Int32"
nullValue="-1"/>
   <result property="Target8" column="Target8" dbType="Int32"
nullValue="-1"/>
   <result property="Target9" column="Target9" dbType="Int32"
nullValue="-1"/>
   <result property="Target10" column="Target10" dbType="Int32"
nullValue="-1"/>
   <result property="Target11" column="Target11" dbType="Int32"
nullValue="-1"/>
   <result property="Target12" column="Target12" dbType="Int32"
nullValue="-1"/>
</resultMap>

The statement section is:

 <statements>
   <procedure id="GetTargets" parameterMap="GetTargetsParams"
resultClass="TargetMatrix">
   MeasuresForMrsProd.dbo.GetTargetMatrix
  </procedure>
</statements>

Any help appreciated.

Regards,
Jason



This correspondence is for the named persons only.
It may contain confidential or privileged information or both.
No confidentiality or privilege is waived or lost by any mis transmission.
If you receive this correspondence in error please delete it from your system immediately and notify the sender.
You must not disclose, copy or relay on any part of this correspondence, if you are not the intended recipient.
Any opinions expressed in this message are those of the individual sender except where the sender expressly,
and with the authority, states them to be the opinions of the Department of Emergency Services, Queensland.