ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antoni Gimeno" <antoni.gimeno-b...@capgemini.com>
Subject parameterMap key validation
Date Mon, 09 Jan 2006 18:20:16 GMT

 

Hi, 

            I'm using parameterMap as follow for all my sql:

 

<parameterMap id="userParamMapForName" class="java.util.HashMap">

                        <parameter property="name"
javaType="java.lang.String" jdbcType="VARCHAR"  />

                        <parameter property="email"
javaType="java.lang.String" jdbcType="VARCHAR"/>

</parameterMap>

 

And I want to validate all the keys (name, email, etc.) sended to iBatis. I
want to use like a contract (interface) within the API. I tried with inline
parameters but can't validate types.

 

Example:

SQL: 

<select id="UserFindByName"  parameterMap = "userParamMapForName"
resultMap="userResultMap">

    <![CDATA[

        SELECT * FROM DEMO_USER WHERE NAME = ? AND EMAIL = ?

     ]]>

</select>

 

If paramterMap doesn't contain name and email keys the select is (I use
p6spy to look into):

SELECT * FROM DEMO_USER WHERE NOMBRE = '' AND APELLIDO1 = ''           

 

 

 

Could any one please help me about it. I need to validate all the keys
passed to iBatis. I want to generate an error if parameterMap does not
contain all the keys.

 

Thanks!

Toni.

 

This message contains information that may be privileged or confidential and
is the property of the Capgemini Group. It is intended only for the person
to whom it is addressed. If you are not the intended recipient, you are not
authorized to read, print, retain, copy, disseminate, distribute, or use
this message or any part thereof. If you receive this message in error,
please notify the sender immediately and delete all copies of this message.

	


This message contains information that may be privileged or confidential and is the property
of the Capgemini Group. It is intended only for the person to whom it is addressed. If you
are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,
 distribute, or use this message or any part thereof. If you receive this  message in error,
please notify the sender immediately and delete all  copies of this message.

Mime
View raw message