Java Mailing List Archive

Home » user-java.ibatis »

Possible to get ibatis to throw an exception if not all params are
filled in?




Author LoginPost Reply


We're using iBatis 2.3 with Tomcat 6.0.26 (Java 1.6). We have many queries
where we pass in parameters (e.g. "#company_id#"), similar to

    <select id="getNightlifeDetailsForHotels"
          SELECT vw_attractions_and_activities.* FROM
vw_attractions_and_activities WHERE (propertyid = #company_id#) and
(subcategoryid = 7) ORDER BY name

I was wondering if there is a way to get ibatis to throw an exception if not
all the parameters are filled in. Right now, it just substitutes a "null"
for parameters that are not included.

Here is an example Java method we use to invoke a query ...

 public static Object queryForObject(String newStmtId, Object inputParams)
throws SQLException {
   if (inputParams.getClass() == HashMap.class || inputParams.getClass() ==
     inputParams = preProcessParameters((Map) inputParams);
   return getSqlMapHandle().queryForObject(newStmtId, inputParams);

Thanks, - Dave
Sent from the iBATIS - User - Java mailing list archive at

To unsubscribe, e-mail: user-java-unsubscribe@(protected)
For additional commands, e-mail: user-java-help@(protected)

©2008 - Jax Systems, LLC, U.S.A.