So long as there is resulting content in the body of the tag the prepend will be added. In your case the "OR" will always be added if the value is not null and therefore will result in the first condition containing "OR" innapropriately in front of it. When your dynamic sql begins to get this complex i would begin to question whether the sqlmap is the right place to accomplish it. You could hide this sql constuction in your dao layer, user java code to construct it and pass the sql in as a literal ($mySql$) to the sqlmap select.
<select...> select * from ECC_CHAMADO $compexWhere$ </select> Brandon On Tue, 15 Mar 2005 15:54:40 +0100, Emiliano Armellin <[EMAIL PROTECTED]> wrote: > Leonardo Holanda ha scritto: > > > How can I correct this? For now, i'm writing a constant expression resulting > 'false' after the opening parenthesis, but it's not very elegant way... > Ibatis wasn't supposed to detect that this OR is unnecessary? Hello > Leonardo, > I've found the same problem writing the sql map described in my post some > days ago (Dynamic Mapped Statements question - 2005-03-11). My solution was > to add some extra test like: > > <isNotEmpty property="company"> OR </isNotEmpty> > > it seems there is a problem using prepend="AND|OR" after parenthesis... or > I haven't understand how it works. > Is there someone who can help us? > > > > -- > > Emiliano Armellin > > > W_ www.ateikon.com > > @_ [EMAIL PROTECTED] > > T_ +39 0422 452101 > >