ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Janet Li <lil_foo...@yahoo.com>
Subject building query using values from 2 lists
Date Wed, 19 Apr 2006 18:03:55 GMT
Hi
   
  I have two lists that I need to iterate in order in build my SQL statement.  I would like
to know how I would go about in doing that using iBatis.
   
  I have 2 list:
  partitionList=[01, 02];
  IDList=[10001, 10002];
   
  Basically it should look like this:
  SELECT DISTINCT NVL(attr_display_name, attr_column_name) as NAME, attr_display_order as
ORDER_VALUE"
        + " FROM md_attr_list_"
          + partitionList[0]
        + " where zeid = "
        + IDList[0] + " and resultset_id = 1";
  union
  SELECT DISTINCT NVL(attr_display_name, attr_column_name) as NAME, attr_display_order as
ORDER_VALUE"
        + " FROM  md_attr_list_"
        + partitionList[1]
        + " where zeid = "
        + IDList[1] + " and resultset_id = 1";
   
  etc...
   
  I should be using the iterate tag but how can I iterate over 2 lists?  The list will always
be the same size.  I believe I can do this using by iterating a list of beans which contains
a value for each of the list.  However, I don't want to create 30 beans if I have 30 items
in my lists.


   
  Thanks.

		
---------------------------------
New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.
Mime
View raw message