create an extra method in your own interface (that extends sun's interface) that will return the records instead of the record numbers
make an atomic operation of the find and multiple reads
Second choice:
make an atomic operation of the find and multiple reads
SCJP 1.4,<br />SCJD progress...
When server received request for a search do two things on server
1. Find the record numbers (Using the find method) which match the search criteria
2. Staying on the server put records corresponding to the record numbers found at step 1 into a string array
THEN return the array to client instead of first sending record numbers to client and then again asking for records corresponding to those recNumbers.
SCJP 1.4,<br />SCJD progress...
When server received request for a search do two things on server
1. Find the record numbers (Using the find method) which match the search criteria
2. Staying on the server put records corresponding to the record numbers found at step 1 into a string array
THEN return the array to client instead of first sending record numbers to client and then again asking for records corresponding to those recNumbers.
If I use the method signature from Sun's interface, I should use the above algorithm.
Here's my thinking:
1) I will implement the functionality of the findByCriteria() method as expected by Sun.
2) However, I will not use this method.
3) I will write a separate method that is similar to the implementation of findByCriteria() method, but returns the matching records directly (not the record numbers).
4) This way, I can avoid reading the database for a second time, inorder to get the records matching the record numbers.
Is this an accepted approach?
SCJP 1.4,<br />SCJD progress...
Rajesh,
Do you mean in your program? I implemented the find (the method from sun's interface) in my Data-class and i implemented find2 (the method from my own interface). find2 uses a call to find because it uses the same logic to find the record numbers.
In the program i use a call to find2 (and find is never called).
Regards,
Roel
A magnificient life is loaded with tough challenges. En garde tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|