Reputation: 878
I have the following java Code
Map temp=new HashMap();
temp.put("RL_ID",rl_Id);
temp.put("User_Id",user_Id);
temp.put("URI",uri);
getSqlMapClientTemplate().queryForMap("AuditReport",------remaining parameters------);
I want to access this map in ibatis and retrive the values of the map in a select query.
<select id="AuditReport" resultClass="java.util.HashMap" parameterClass="java.util.HashMap">
Select BIO_RESEARCH_LOCATION_USER.id from BIO_RESEARCH_LOCATION_USER WHERE -----remaining query---------
What will be an appropriate way to complete the remaining query and the java function.
Upvotes: 0
Views: 1991
Reputation: 129
Assuming the columns names in BIO_RESEARCH_LOCATION_USER
are the same as the params you're putting in the Map, you'll need to do something like this:
<select id="AuditReport" resultClass="java.util.HashMap" parameterClass="java.util.HashMap">
Select BIO_RESEARCH_LOCATION_USER.id
from BIO_RESEARCH_LOCATION_USER
WHERE BIO_RESEARCH_LOCATION_USER.RL_ID = #RL_ID#
AND BIO_RESEARCH_LOCATION_USER.User_ID = #User_ID#
AND BIO_RESEARCH_LOCATION_USER.URI = #URI#
</select>
If you don't want quotes around a param, you should use $
instead of #
. For e.g., if you don't want quotes around RL_ID, you'll need to use $RL_ID$
instead of #RL_ID#
above.
Upvotes: 1