Actually, you can use 1 map and call it 10 times, with <delete id="trimTable" > delete from $tablename$ $whereClause$</delete>as the query. And pass parmMap for tablename and whereClause vars.

Nathan Maves wrote:
Not sure how you are going to avoid writing 10 different sql statements.... and now you have some sql based in two different places (.java and .xml).

I think you are over thinking this and would have already been done if you just placed the 10 delete statements in your sqlmap files :)

of course this is just my opinion

Nathan

On 10/16/07, *Navanee* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:


    Hi

    Is there a way to pass dynamic Query values to delete statement.
    like below

        <delete id="trimTable"  parameterClass="String" >
            $value$
        </delete>

    In my case, I need to delete some ten tables, But I want to have
    only one
    delete sql map statement like above instead of having ten
    different SQL
    statement,

    I'll pass the $value$ as below for all tables,

               String dynamicQuery = "DELETE FROM TABLE1 WHERE NAME =
    'TEST'";
                sqlMapper.delete("trimTable",dynamicQuery);

    I wrote a sample code to achive the above, but during execution
    the code
    hangs and does not come out of it, when there is a valid data to
    delete, But
    finishes it execution where there is no data in the table.

    What might cause the above issue, is there any workaround/solution for
    this...

    Could someone please share/provide solution on this?

    Thanks and Regards,
    Navanee
    --
    View this message in context:
    
http://www.nabble.com/How-to-achieve-Dynamic-SQL-query-in-delete-statement-tf4634689.html#a13235168
    Sent from the iBATIS - User - Java mailing list archive at
    Nabble.com <http://Nabble.com>.



Reply via email to