ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Azzopardi <...@tigerfive.com>
Subject conditionally add a table to the from clause just once if either or both of two parameters is not empty
Date Thu, 22 Feb 2007 13:57:34 GMT

ibatis2.2 java5 and 6 on winXpSp2

I'm using the code below to conditionally add a table to the from clause of
my sql if one or other or both of two parameters is not empty. (The tricky
bit is not to include add the table twice).

The following works, but I wondered if there was a simpler way that avoids
my ugly /*dummy*/ cludge.
(Without the /*dummy*/ nothing is ever generated.) 

<dynamic prepend=", suppliers_for_parts sp">
  <isNotEmpty property="supplierCompanyId"  >
    /*dummy*/
  </isNotEmpty>
  <isNotEmpty property="supplierRef">
    /*dummy*/
  </isNotEmpty>
</dynamic>
-- 
View this message in context: http://www.nabble.com/conditionally-add-a-table-to-the-from-clause-just-once-if-either-or-both-of-two-parameters-is-not-empty-tf3272865.html#a9100250
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message