ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Blue <ericblu...@gmail.com>
Subject Re: Multiple deletes? [signed]
Date Thu, 08 Dec 2005 18:16:12 GMT
I do something similar for selects using iteration.  In this case I use a
HashMap for my parameter class:

...
select * from table where name in
<iterate property="nameList" open="(" close=")" conjunction=",">
  #nameList[]#
</iterate>

...

On 12/8/05, Vijai Senthil Padmanabhan Kalaiyarasi <
vijaisenthil.padmanabhan@kumaran.com> wrote:
>
> Mike,
>
> try using $ instead of #, as
> DELETE FROM ALERTS WHERE ID IN ($value$)
> this would replace the string you pass as it is.
>
> In case of # it wud take it as a single parameter and execute it as
> DELETE FROM ALERTS WHERE ID IN  '322,321,320,319,318,317,316,315,314,313'
> since u pass the parameter type as String, u r getting the error "Invalid
> character string format for type INTEGER".
>
>
> Vijai
>
> ----- Original Message -----
> From: "Michael Laccetti [c]" <michael@s2g-limited.com>
> To: <user-java@ibatis.apache.org>
> Sent: Thursday, December 08, 2005 12:13 PM
> Subject: Multiple deletes? [signed]
>
>
> >I have the following statement defined in iBATIS:
> >
> > <delete id="deleteAlerts" parameterClass="java.lang.String">
> >  DELETE FROM ALERTS WHERE ID IN (#value#)
> > </delete>
> >
> > I pass it a String in the form of
> 322,321,320,319,318,317,316,315,314,313.
> >
> > Now, when I call it, I get the following:
> > DEBUG [08 Dec 05 11:19:26] [http-8080-Processor23]
> > java.sql.PreparedStatement - {pstm-100004}
> PreparedStatement:      DELETE
> > FROM ALERTS WHERE ID IN (?)
> > DEBUG [08 Dec 05 11:19:26] [http-8080-Processor23]
> > java.sql.PreparedStatement - {pstm-100004} Parameters:
> > [322,321,320,319,318,317,316,315,314,313]
> > DEBUG [08 Dec 05 11:19:26] [http-8080-Processor23]
> > java.sql.PreparedStatement - {pstm-100004} Types: [java.lang.String]
> > ERROR [08 Dec 05 11:19:26] [http-8080-Processor23]
> > com.cibcwm.go.otis.gowmon.web.struts.action.IndexAction - Could not
> remove
> > alert(s) from database.
> > com.ibatis.common.jdbc.exception.NestedSQLException:
> > --- The error occurred in conf/gowmon.xml.
> > --- The error occurred while applying a parameter map.
> > --- Check the deleteAlerts-InlineParameterMap.
> > --- Check the statement (update failed).
> > --- Cause: org.apache.derby.client.am.SqlException: Invalid character
> > string
> > format for type INTEGER.
> >
> > I know that the statement itself is valid; I can run it directly no
> > problem.
> > The question is, how do I get this to work with iBATIS.
> >
> > Mike
> >
> >
> >
> > --
> > ------------------------ [ SECURITY NOTICE ]
> > ------------------------
> > To: user-java@ibatis.apache.org.
> > For your security, michael@s2g-limited.com
> > digitally signed this message on 08 December 2005 at 17:13:08 UTC.
> > Verify this digital signature at http://www.ciphire.com/verify.
> > ------------------- [ CIPHIRE DIGITAL SIGNATURE ]
> > -------------------
> > Q2lwaGlyZSBTaWcuAjh1c2VyLWphdmFAaWJhdGlzLmFwYWNoZS5vcmcAbWljaGFlbEBzM
> > mctbGltaXRlZC5jb20AZW1haWwgYm9keQCRBAAAfAB8AAAAAQAAAKRpmEORBAAA+gIAAg
> > ACAAIAIIXYnAvwVJnXYkeNqqLiR5ZyHRK7W0tiTAYcV7p1uX8mAQAxTkdmLdtsIbMe4FE
> > 6BpyDx/u9eVN0WyoQPcWCmWDyDyXMR7c9Y2Wbc8tSrj1A6oL/fBcWG/Gbi5x1dLjIJzg3
> > om8fU2lnRW5k
> > --------------------- [ END DIGITAL SIGNATURE ]
> > ---------------------
> >
>
>

Mime
View raw message