wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes readRecord vs findByCriteria Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "readRecord vs findByCriteria" Watch "readRecord vs findByCriteria" New topic
Author

readRecord vs findByCriteria

Ed Green
Greenhorn

Joined: Jun 15, 2004
Posts: 11
Hello all,
I'm doing B&S assignment, and have the following interface:

and


Maybe i'm missing something, but findByCriteria() returns a list of record numbers, which i can't return to the client, so i guess i'll have to do a readRecord() of all the records using that long[], but i've just physically read all of them to do the findByCriteria()!
Seems like a waste. What am i missing?
Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532
hi Ed:
public String [] readRecord(long recNo)

The readRecord(long recNo) method will come handy if a client knows which record to display. I use this method in delete and update. If a client attempt to delete record n, the client can display record n before deleting it, this way it ensures no records will be deleted by mistake.


SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
Anthony Watson
Ranch Hand

Joined: Sep 25, 2003
Posts: 327
You could call readRecord in findByCriteria to get a record's data to compare to the criteria array.


Anthony W.<br />MCP, SCJP 1.4, SCJD, SCWCD 1.3, SCWCD 1.4, SCBCD
Ed Green
Greenhorn

Joined: Jun 15, 2004
Posts: 11
Hi Hanna,
Tnx for the usage ideas, makes sense.

Anthony,
Thanx for the reply, i was thinking the same thing, but i don't know the exact record count, but i guess i could call read with an ever increasing number until i get EOF..
Hans Nemarich
Greenhorn

Joined: Jun 10, 2004
Posts: 1
ED, you can try something like this to know how many records are:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: readRecord vs findByCriteria
 
Similar Threads
URLBird find by Hotel or Name
NX: findByCriteria Method
[NX] Question about the findByCriteria.
Confuse the findByCriteria()
B&S What Are You Guys Passing Into Your findByCriteria For criteria[2] Thru [5]?