Java Mailing List Archive

http://www.java2.5341.com/

Home » user-java.ibatis »

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

laredotornado

2010-06-03

Replies:

Author LoginPost Reply

Hi,

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"
resultMap="SearchResultSQLMaps.searchResultNightlifeMap"
parameterClass="java.util.Map">
          SELECT vw_attractions_and_activities.* FROM
vw_attractions_and_activities WHERE (propertyid = #company_id#) and
(subcategoryid = 7) ORDER BY name
    </select>

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() ==
Hashtable.class)
     inputParams = preProcessParameters((Map) inputParams);
   return getSqlMapHandle().queryForObject(newStmtId, inputParams);
 }

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


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

©2008 java2.5341.com - Jax Systems, LLC, U.S.A.