ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Maves <nathan.ma...@gmail.com>
Subject Re: Not identifying missing parameter names
Date Wed, 21 Oct 2009 17:11:30 GMT
I dont think that this is possible from this direction.  Remember that the
sqlmap was just doing a map.get("cust_id") and getting null back which is
the expected behavior.
On the flip side you might be able to have a check on the @Param to see if
there is actually a var in the sqlmap named that.  We dont do that right now
but you could extend IB to do that if you wanted to.

I think we have the best solution right now for most situations.
One way to get around this would be to use an actual class for your
parameter.  This way you will get this check by default.  And you can be a
bit more type safe.


On Tue, Oct 20, 2009 at 11:47 PM, Guy Rouillier <guyr-ml1@burntmail.com>wrote:

> I'm using the new multiple parameter capability in the latest version 3
> beta.  I have a method like this in my mapper Java class:
> List<Contact> selectContactType(@Param("aCustId") String aCustId,
> @Param("eContactType") Contact.ContactTypeEnum eContactType);
> These parameters are used in the WHERE clause.  Here is the text from the
> XML file:
> where
>   cust_id = #{aCustId, javaType=String, jdbcType=VARCHAR}
>   and contact_tp_id = #{eContactType.intValue, javaType=int,
> jdbcType=VARCHAR}
> When I first created this, I had a typo in the XML:
>  cust_id = #{cust_id}
> My application simply reported no data; no errors were logged anywhere.
> Since I'm using named parameters in a Java map, shouldn't iBatis be able to
> tell that the #{cust_id} value I had specified in the SQL was not in the
> map?  It then could have logged an error, which would have greatly assisted
> in identifying why my app wasn't showing any data.
> Thanks.
> --
> Guy Rouillier
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org

View raw message