Pawel Pawlowicz wrote:That's what I am doing.
I implemented find() using AND approach. A record is added to results when and only when all fields matches the criteria.
As find() method in Sun's interface matches using startsWith() and GUI should display only records that exactly matches, I extended Sun's interface and added method findExact().
So I don't need to filter any results in GUI nor buisness layer. I also don't have to worry whether there were any modifications to the database between find() being executed and filtering.
For the GUI. I have two text fields. One for name and one for location.
If both are blank then I return all records.
If one of them is blank I return records that exactly match a criterion in the other.
If both are filled I return records that match both of the criteria exactly.
What do you think?
Hi Pawel!
Glad to see that we are on the same page. My approach almost exactly match yours, and in my opinion it should be fine. Well, we'll find out soon, because I'm going to submit my app in about 10 days.
The only difference is that I use just the original find method (which returns records using the AND approach) and then I do the filtering in the service layer for exact match when is the case.
In my GUI I have separate 'Exact match' checkbox for each field, so the user can search let's say for a name starting with something and a city which exactly match the user input. - But this flexibility is beyond the requirement.
Roland