|
Hi Jeff, We have just upgraded to use the latest
abator and iBATIS. We have a scenario as: -
Get all
users from a table - USERS -
For each
user, find some information from another table What we did with the old Abator was: -
Create a
UserProfileExample object. -
Set the
user_id indicator in the example object -
For each
user in the given list do the following o
Set the
user_id field in the UserProfileExample with the required value for which
information needs to be retrieved. o
Fire the
select using the required DAO o
Obtain
required information and do something The new Abator introduces the criteria object
for the example class. We tried to fit this into the loop written earlier. Below
is what we have needed to do: -
UserProfileExample
userProfileExample=new UserProfileExample(); -
Criteria
criteria=userProfileExample.createCriteria(); -
For each
user in the given list do the following o
èif(criteria.getCriteriaWithSingleValue().size()>0)
criteria.getCriteriaWithSingleValue().remove(0); o
criteria.andUserIdEqualTo(userID); o
Fire the
select using the required DAO o
Obtain
required information and do something There is only a way to add a criterion to
an example object, no way to remove/change it. Perhaps the design means us to
create a new example for each new query fired? However, my query is something like a
parameterized query where I simply need to change the value of the parameter and
fire the query again. I do not like the fact that I need to reach into the internals
of the criteria object and remove elements from the list that it maintains (è). Can you suggest a better way to do the
same? Regards ~Rashmi |
- Using new Abator generated criteria and example Rashmi Dixit
- Re: Using new Abator generated criteria and example Jeff Butler
- RE: Using new Abator generated criteria and example Rashmi Dixit
