wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes RecNo in B&S Interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "RecNo in B&S Interface" Watch "RecNo in B&S Interface" New topic
Author

RecNo in B&S Interface

Anita S�rensen
Greenhorn

Joined: Oct 17, 2007
Posts: 11
In my B&S assignment the Interface states that I have to use a recNo for identifying records. I can not find any "must" statements on what this recNo actually represent. So far I have used recNo as the offset of a record, and implemented it as a member in Contractor to preserv it. I do not wish to use a Map or similar to map between record offsets to e.g. number 1,2,3 as these numbers are not necessary for any logcal code.

Is this an ok solution? What has others done?


SCJP - done, SCJD - ?
Musab Al-Rawi
Ranch Hand

Joined: Aug 06, 2007
Posts: 231
Hi Anita,

record number is integer while the location in the file is long, I think it would be much better if you consider the record number as its order in records in the file... that's what I am doing, of course that will cause you to use some sort of mapipng (HashMap) to map record number with its location in the file.

You Defiantly you don't need to save the record number in the Contractor class (dealing with like name, location etc) and I think you _shouldn't_.


SCBCD - SCWCD - SCJD - SCJP - OCA
Anita S�rensen
Greenhorn

Joined: Oct 17, 2007
Posts: 11
My record number (recNo in interface) is not integer but long. There is no description of record number in the interface. I still can't see why this HAS to be the order in the database...

Other opinions?
Musab Al-Rawi
Ranch Hand

Joined: Aug 06, 2007
Posts: 231
Ok, in my assignment the recNo is int, we are probably working on a different version.

Don't you think that this is kind of misleading, I mean record number (recNo) is different from record offset. I told you the way i did it and I think it is cleaner, I agree that you will have to use a HashMap to map the record number to its offset but I think it is worth it. It's your call after all.

Good Luck
Adrian Engler
Greenhorn

Joined: Sep 18, 2006
Posts: 29
In my assignment, the record number has the type long, too.

However, in my assignment, the number of bytes per record is fixed. So, it is no problem to calculate the file offset from the record number (I read the database header where the fields and their length are defined when the server is started).


SCJP 5.0 (93%), SCWCD (98%), SCJD (377/400), SCBCD (100%)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: RecNo in B&S Interface