ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Toby Thain <t...@smartgames.ca>
Subject Re: Placeholder and Update statement
Date Wed, 25 Jun 2008 20:29:07 GMT

On 25-Jun-08, at 2:32 PM, Dott. Christian OLIVIERI wrote:

> Hi, this is my problem:
> I want create a single java procedure to update a field on  
> different table. For the reading statement all is right but for the  
> update not.
> The xml file hold the following code:
> <update id="setlocker">
>        $query$
> </update>
> And the Java code is
> String strStr = "UPDATE REGION SET locked='admin@123' WHERE ID=10";
> mapToGiveIbatis = new java.util.HashMap(1);
> mapToGiveIbatis.put("query", strStr);

Putting the SQL inline in your code basically defeats the purpose of  
using iBATIS. What's probably screwing this up is string quoting. Put  
the query in your map and use parameters.


> ourutils.utils.sqlMap.update("setlocker", mapToGiveIbatis);
> No errors and no exceptions thrown but my table was not updated.
> Where I'm wrong?

View raw message