ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brandon Goodin <brandon.goo...@gmail.com>
Subject Re: Question on dynamic prepend and using multiple properties
Date Wed, 18 May 2005 00:36:35 GMT
Don't forget the new functionality available in 2.1.0

<dynamic prepend="HAVING" open="(" close=")">
<isNotEmpty property="countA">
 count &gt; #countA#
</isNotEmpty>
<isNotEmpty prepend="AND" property="countB">
 count &lt; #countB#
</isNotEmpty>
</dynamic>

Brandon

On 5/17/05, Ron Grabowski <rongrabowski@yahoo.com> wrote:
> Have you tried this:
> 
> <dynamic prepend="HAVING">
> (
>  <isNotEmpty property="countA">
>   count > #countA#
>  </isNotEmpty>
>  <isNotEmpty prepend="AND" property="countB">
>   count < #countB#
>  </isNotEmpty>
> )
> </dynamic>
> 
> --- Narasimha Prasad <prasadn@dbo2.com> wrote:
> > Here is a problem that I am facing.
> >
> >
> >
> > My parameter class has two counts, say countA and countB and I need
> > to use
> > these in a 'HAVING' clause in the sql query.  Both the values could
> > be
> > empty.
> >
> > For eg. if they both have values, the query would look like:
> >
> >
> >
> > Select ….
> >
> > --- from…
> >
> > where….
> >
> > HAVING ( countA > 5 and count B < 10 )
> >
> >
> >
> > I tried using nested dynamic clause, but looks like it is not
> > supported.
> >
> > <dynamic prepend="HAVING">
> >
> >  (
> >
> >    <isNotEmpty property="countA">
> >
> >      count > #countA#
> >
> >    </isNotEmpty>
> >
> >
> >
> >    <dynamic prepend="AND">
> >
> >      <isNotEmpty property="countB">
> >
> >        count < #countB#
> >
> >      </isNotEmpty>
> >
> >    </dynamic>
> >
> > )
> >
> > </dynamic>
> >
> >
> >
> > Is there any other approach to solve this problem, other than going
> > thru and
> > checking every combination of countA and countB ?  Any
> > help/suggestion is
> > appreciated
> >
> >
> >
> >
> >
> > Thanks,
> >
> > Prasad
> >
> >
> >
> >
> > --
> > No virus found in this outgoing message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.308 / Virus Database: 266.11.9 - Release Date: 5/12/2005
> >
> >
>
Mime
View raw message