ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ashish Kulkarni <ashish.kulkarn...@gmail.com>
Subject Issue with SQL query in ibatis
Date Fri, 20 Feb 2009 20:44:01 GMT
HiI have a query as below where resultClass is same as parameterClass, for
some reason the response i get when i run this query is parameterClass, for
example if i input as

EnvNames envNames = new EnvNames();
envNames.setTYPE("APPROVALS");
envNames.setAS400NAME("PGMAPSD1");
envNames.setENVNAME("MAPS6301S2");

<select id="getEnvNames"
resultClass="com.pfizer.maps.base.data.file.EnvNames"
parameterClass="com.pfizer.maps.base.data.file.EnvNames">
SELECT TYPE, AS400NAME, ENVNAME, ENVDESC, DISABLED, INIPROG,
INIPGMLIB, USERID, PASS_WRD, MAPSLOGINR FROM EnvNames WHERE TYPE =tYPE and
AS400NAME =aS400Name and ENVNAME=eNVNAME
</select>

I get response as below, which is wrong, because i am looking for
MAPS6301S2, and it is returning MAPS6301S1.
 Result: [APPROVALS           , PGMAPSD1  , MAPS6301S1, Approvals -
MAPS6301S1                            ,  ,           ,           ,
,
                          ,  ]

So i changed this query to use parameterMap as below


<parameterMap id="EnvNamesMap" class="java.util.HashMap">
<parameter property="type" javaType="java.lang.String" />
<parameter property="as400name" javaType="java.lang.String" />
<parameter property="envname" javaType="java.lang.String" />
</parameterMap>
<select id="getEnvNamesByMap"
resultClass="com.pfizer.maps.base.data.file.EnvNames"
parameterMap="EnvNamesMap" >
SELECT TYPE, AS400NAME, ENVNAME, ENVDESC, DISABLED, INIPROG,
INIPGMLIB, USERID, PASS_WRD, MAPSLOGINR FROM EnvNames WHERE TYPE =? and
AS400NAME =? and ENVNAME=?
</select>

When i pass the same parameters in Map i get null as result set, which is
what i am expecting,
any idea why this is happening

Ashish

Mime
View raw message