Hi Anurag, 

 

Thanks for the quick response.

How does your sql look?

 

I am looking for something like 

select * from abc where xyz = 'sss' and ccc not in (12,34,56) or ccc is
null

I could also use  this with a NVL like 

select * from abc where xyz = 'sss' and nvl(ccc,'!!!') not in (12,34,56)


 

I got the NVL() get to work by defining a method in the example for the
criteria

 

 

Thanks

Vinaya

 

________________________________

From: Anurag Sethi [mailto:asethi...@yahoo.com] 
Sent: Wednesday, January 07, 2009 4:44 PM
To: Vinaya Tirikkovalluru
Subject: Re: Or Criteria with Ibator

 

I used the following combination of ANDs and ORs. Hope this helps.

MyExample example = new MyExample();
        Iterator<MyItem> items =
itemToDispShipOption.keySet().iterator();
        MyExample.Criteria criterion = null;
        HashMap<String,MyItem> map = new HashMap<String,MyItem>();
        
      while(items.hasNext()){
            MyItem item = items.next();
          
            MyOption shipOption = itemToDispShipOption.get(item);
            criterion = example.createCriteria();
            example.or(criterion);
            criterion.andSessionIdEqualTo(sessionKey);
            if(-1!=partnerId)
                        criterion.andPartnerIdEqualTo(partnerId);
            criterion.andItemIdEqualTo(item.getItemId());

           criterion.andSmIdEqualTo(shipOption.getShipMethodID());
        }
        example.setOrderByClause("partner_id,sm_id,item_id");
        try{
            allSelected =
getCachedShippingOptionPriceDAO().selectByExample(example);
        }catch(SQLException sqlE){
           logger.log(Level.SEVERE,sqlE.toString());
        }

--- On Wed, 1/7/09, Vinaya Tirikkovalluru
<vinaya.tirikkovall...@converge.com> wrote:

From: Vinaya Tirikkovalluru <vinaya.tirikkovall...@converge.com>
Subject: Or Criteria with Ibator
To: user-java@ibatis.apache.org
Date: Wednesday, January 7, 2009, 9:32 PM

Hi,

 

Did any one use or in the where clause combined with an and condition?

Any ideas how to use NVL function in Ibator?

 

Thanks

Vinaya

________________________________

This electronic message is intended only for the use of the
individual(s) or entity(ies) named above and may contain information
which is privileged and/or confidential. If you are not the intended
recipient, be aware that any disclosure, copying, distribution,
dissemination or use of the contents of this message is prohibited. If
you received this message in error, please notify the sender
immediately. 

 



This electronic message is intended only for the use of the individual(s) or 
entity(ies) named above and may contain information which is privileged and/or 
confidential.  If you are not the intended recipient, be aware that any 
disclosure, copying, distribution, dissemination or use of the contents of this 
message is prohibited.  If you received this message in error, please notify 
the sender immediately.

Reply via email to