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: How to achieve Dynamic SQL query in delete statement
Date Tue, 16 Oct 2007 21:07:58 GMT
you sure can, but again you are then storing you SQL in your .java files :)

On 10/16/07, Lisa Jenkins <lisa.jenkins@investoranalytics.com> wrote:
>
> 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* <navaneethankrish@yahoo.com
> > <mailto:navaneethankrish@yahoo.com>> 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>.
> >
> >
>
>

Mime
View raw message