This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes key field in find method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "key field in find method" Watch "key field in find method" New topic

key field in find method

michael opto

Joined: Jan 17, 2002
Posts: 29
The following is the comment of the find method from my Data class. From the body of the method, I can tell it is using the first element of the String array expression of a record, which is the flight number. I am confused about: "For this assignment, the key field is the record number field.". What is this record number field?
Thanks in advance!
* This method searches the database for an entry which has a first
* field which exactly matches the string supplied. If the required
* record cannot be found, this method returns null. For this
* assignment, the key field is the record number field.
* @param toMatch The key field value to match upon for
* a successful find.
* @return DataInfo The matching record.
* @exception DatabaseException Thrown when database file could not be accessed.
public synchronized DataInfo find(String toMatch) throws DatabaseException {
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17271

The find method compares the argument String to the flight number field. This is the character based field in the db.db. Do not confuse this field with the actual record number, which you pass to the locking mechanism.

Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
michael opto

Joined: Jan 17, 2002
Posts: 29
Have you checked out Aspose?
subject: key field in find method
It's not a secret anymore!