ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Grabowski <rongrabow...@yahoo.com>
Subject Re: Question on dynamic prepend and using multiple properties
Date Tue, 17 May 2005 13:56:21 GMT
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