byte? doesn't work as a parameter type in an iBatis parameterMap
-
14-10-2019 - |
Question
According to the iBatis docs, using "byte?" as a type value should work in parameterMap
. I'm using DataMapper version 1.6.1.
The error message I'm getting is: Could not load type from string value 'byte?'.
It's a configuration exception which shows this information in the stack trace:
The error occurred while loading SqlMap.
- Check the parameter mapping typeHandler attribute '' (must be a ITypeHandlerCallback implementation).
- The error occurred in [sqlMap embedded="MyApp.Data.Config.Rate.xml, MyApp" Mxmlns="http://ibatis.apache.org/dataMapper"]
- Check the Rate.InsertParams.]
Here's the XML block for Rate.InsertParams:
<parameterMaps>
<parameterMap id="InsertParams" class="RateCategory">
<parameter property="RateId" column="RateId" type="int"/>
<parameter property="Name" column="Name" type="string" size="32"/>
<parameter property="Charge" column="Charge" type="decimal?"/>
<parameter property="ChargeTypeId" column="ChargeTypeId" type="byte?"/>
</parameterMap>
Any ideas why it won't work?
Solution 2
After lots of asking and posting, the final answer is that the docs are wrong.
The official iBatis.Net forum had this to say:
"You have a few options:
- just use type="byte"
- don't specify the type
- byte? is syntactic sugar System.Nullable`1[[System.Byte]]"
Which is basically what I had already figured out myself. int? works but byte? doesn't. Neither does short? or long?.
The docs need to be fixed.
OTHER TIPS
As far as I can tell, there isn't any "byte?" alias. Here is a proof.
You can also figure out what is for sure supported and what not from this file.
"Code never lies." Documentation does :(