Is there a way to throws an exception if an property from the input
parameter evaluates to null in iBatis 3.0?
I have a generic query engine that accepts iBatis configuration files
and a parameter map as input. As a result the query engine only
passes the parameter map to iBatis without knowing what properties in
the map are required. When a property is null or missing iBatis may
throw a parsing exception because it does not know the datatype of the
property, the DBMS server may throw an sql query parsing exception, or
the query will execute producing unexpected results. Ideally I would
like to use a mode in the query parameter, like
#{col2Value,nonNullValue=required}, that would cause iBatis to throw
an exception when the property evaluated to null.
As an example, I would like iBatis to throw an exception, like
"MissingParameterException", when the property "col2Value" is null or
not in the parameter map.
<mapper namespace="com.foo.example">
<select id="sampleQuery" parameterType="Map" resultType="Map">
select column_1 from foo where column_2 = #{col2Value}
</select>
</mapper>
Paul Spencer
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org