wood burning stoves
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Thoughts on searching Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Thoughts on searching" Watch "Thoughts on searching" New topic

Thoughts on searching

Frans Janssen
Ranch Hand

Joined: Dec 29, 2004
Posts: 357
Hi all,

I have the B&S assignment. The interface I am given contains a search method that returns an array of record numbers that presumably match the search criteria.

The records as found by a search action are of course not locked, so when I read the records, they might have been changed by another client in the meantime and possibly do not match the search criteria anymore.

I have thought of three possible solutions:

1. just ignore this; if all that the clients can do is book a record, then at most the customer field is changed and since this is not a searchable field, it does not affect search results.

2. read in the records and do a second check to test if the read records still match the search criteria (remove records that don't from the search results).

3. read all records from the server (use search method with null search criteria) and do matching with the criteria client-side. This solution of course loads the network quite heavily, so I assume I won't please my assessor with this one. For thin client architectures this might be an option though.

Currently I am leaning towards solution 2, because that one will continue to work correctly if changes other than booking are made concurrently to the database. Do you think this solution is overkill or maybe someone found a better solution?

Thanks for your thoughts,


Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
Hmmm, I am actually leaning toward solution number one. I think that as long as you document this as a known limitation that does not affect the overall functionality of the application, you should be fine.

“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
I agree. Here's the link: http://aspose.com/file-tools
subject: Thoughts on searching
It's not a secret anymore!