Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

readRecord vs findByCriteria

 
Ed Green
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Anthony Watson
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could call readRecord in findByCriteria to get a record's data to compare to the criteria array.
 
Ed Green
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ED, you can try something like this to know how many records are:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic