ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Espen Rydningen <es...@rydningen.no>
Subject QueryByExample - querying on same column with different values
Date Tue, 25 Apr 2006 19:43:19 GMT

I'm new to Ibatis, so if this is a stupid question, you'll have to excuse
me. I've downloaded Abator for Eclipse and generated maps/DAOs and models.
In this example it's an agreement table between a buyer and a seller. This
table also got a status field the buyer and the seller for each agreement.
So my task is to get a list of agreements where the status for the buyer is
either 'A' for approved or 'P' for pending, and the status for the seller is
either 'A' or 'P'.

I've come this far:

AgreementIbatisExample example =  new AgreementIbatisExample();

AgreementIbatisDAO agreementDao =
List<AgreementIbatis> list = agreementDao.selectByExample(example);

But this only gives med the list with both statuses is set to "A", I also
want the list to contain records where the statuses also is "P" and where
either is "P" or "A".

Is the answer to my task that I've got to do this operation 4 times, each
time changing the values in the parameters ([A,A] [A,P] [P,P] [P,A]) and
then combining the results in one result-list?

- Espen

View raw message