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: query by example
Date Wed, 22 Feb 2006 22:29:41 GMT
CarExample inherits the setMilage() method.  The setMilage() method is in
the superclass - probably Car.java.

You can't do a range with the generated methods - you'll have to write a
custom query for that.

Jeff Butler



On 2/22/06, Tony Qian <daqiqian2@aol.com> wrote:
>
> Jeff,
>
> Thanks for the prompt response. However, there is no method such as
> setMileage() in the CarExample.java. If I have a query criterion with
> range, for example car price from $5000 - 10000, how do I use CarExample
> class to set it up?
>
> thanks,
> Tony
>
> Jeff Butler wrote on 2/22/2006, 3:15 PM:
>
>  Try this:
>
> CarExample ce = new CarExample();
> ce.setMilage(50000);
> ce.setMilage_Indicator(CarExample.EXAMPLE_LESS_THAN);
> List list = carDao.selectByExample(ce);
>
> Jeff Butler
>
>
> On 2/22/06, Tony Qian <daqiqian2@aol.com> wrote:
> >
> > I just downloaded abator and denegrated xml, dao, and
> > model codes. I can not figure out how to use query by
> > example style selection.
> >
> > Here is one method in dao.
> >
> >    /**
> >      * This method was generated by Abator for iBATIS.
> >      * This method corresponds to the database table
> > carproject.car
> >      *
> >      * @abatorgenerated Wed Feb 22 03:05:24 EST 2006
> >      */
> >     public List selectByExample(CarExample example) {
> >         return selectByExample(example, null);
> >     }
> >
> > one of the methods in CarExample
> >
> >    /**
> >      * This method was generated by Abator for iBATIS.
> >      * This method corresponds to the database table
> > carproject.car
> >      *
> >      * @abatorgenerated Wed Feb 22 03:05:24 EST 2006
> >      */
> >     public void setMileage_Indicator(int
> > mileage_Indicator) {
> >         this.mileage_Indicator = mileage_Indicator;
> >     }
> >
> > Can someone give me some very brief code to select a car
> > with mileage less than 50,000 miles?
> >
> > Appreciate your help,
> > Tony
>
>
>

Mime
View raw message