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: hardcoding value in result map
Date Mon, 31 Dec 2007 21:59:25 GMT
With out really knowing the reasoning I can only guess at what you are
trying to get here....

you could do the following...

String value = (String)queryForObject("mapname", "some.value");

and in your map do

<select id="mapname" resultClass="string">
  select $value$ from dual

In this example you will get the same value that was sent in.  I am sure you
can see how you could embed this into a more complex example but it show you
that it is possible.  Like we always state be careful when you use this
'feature' of ibatis as it truly is just string substitution and could open
your code up to sql injection.


On Dec 31, 2007 2:49 PM, bhaarat Sharma <bhaarat.s@gmail.com> wrote:

> Hi,
> We are converting our traditional ResultSet code to iBatis.  But are
> facing a problem now.
> Is there a way to pass a hardcoded value in the resultMap instead of a
> column? this hard coded value will come from a javaCode.
> so something like this
> <result property=\"numberMembers\" column=\"value passed from java
> code will come here\"/>
> Thanks..

View raw message