ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: How do I customize the criteria
Date Wed, 12 Dec 2007 21:57:29 GMT
Here's one way to do it.  First make this class...

public class MyCriteria extends XYZExample.Criteria {
  public MyCriteria addCustomCriteria(String value) {
    addCriterion("col1 || \"\" like", value, "col1");
    return this;
  }
}

Then use it like this...

XYZExample example = new XYZExample();
MyCriteria myCriteria = new MyCriteria();
example.or(myCriteria);
myCriteria.addCustomCriteria("some value");
List answer = dao.selectByExample(example);


Jeff Butler




On Dec 12, 2007 2:47 PM, Vinaya Tirikkovalluru <
vinaya.tirikkovalluru@converge.com> wrote:

>  Hi,
>
>
>
> I have a case where I need to do the following
>
>
>
> Select * from abc.XYZ where col1 || "" Like (some value)
>
>
>
> How do I do that?
>
> I tried extending the Example class and Criteria. Had some problems,
> though.
>
>
>
> Was hoping somebody might have done it earlier.
>
>
>
> 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.
>
>

Mime
View raw message