ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shan Syed" <shan...@gmail.com>
Subject transparent values to SQL statements?
Date Sat, 14 Jul 2007 00:16:01 GMT
Hi,

I'd like to transparently send parameters to SQL functions, without having
to include those parameters always through my code.
For example,

<select id="getAllMatchingPeople" parameterClass="com.blah.Person"
resultMap="personParameterResult">
SELECT * from person
WHERE
lastname = #lastname#
AND
recordstatus = #recordstatus#
</select>

Where the "recordstatus" property is not inside my Person domain object, but
something configured separately; perhaps "injected" into the map object
somehow.

Thus, my code would look like this:
sqlMap.queryForList("getAllMatchingPeople", myPersonQueryByExampleObject);

Is there a way to achieve this in a straight forward manner? I don't want to
have multiple SQL function and fragments for the status, since
there could be many many statuses, all of which will be applied under
different contexts.

Mime
View raw message