Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

key field is record number or flight number?

 
mao lao
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in method find(String toMatch) in Data.java
says key field is the record number field, but look like flight number field
Thanks
 
Stephane Weber
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're right.
I didn't even noticed that the Javadoc stated the key was the record number, but I noticed that it indeed actually used the flight number.
Stephane
 
Andrea Gazzarini
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi mao,
The string supplied is the flight number, because the record number of a specified fly is calculated with the file pointer. It isn't a data present on db.db
 
Aruna Raghavan
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
What about lock and unlock methods using the record number? It looks like to me, if I use recordNumber for locking, I would have to generate a primary key like id for each record and use that. It does not make sense to expose a file pointer to the business logic layer. Is this what we are expected to do?
Thanks,
Aruna.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aruna - You do not need to create a primary key at all. The lock and Unlock take a record number, but it doesn't have to go search for the record in the db.db file, so it doesn't use a file pointer at all in those methods.
Do a search on LockManager here and you will find an even better way to handle locks without having to implement lock/unlock in the Data class.
Mark
 
John Lee
Ranch Hand
Posts: 2545
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by mao lao:
in method find(String toMatch) in Data.java
says key field is the record number field, but look like flight number field
Thanks


I think the key field is record number, when you lock/unlock, you have to supply record number. Regarding flight number, it is peopel that want to make it unique, for the sake of convenience.
 
Aruna Raghavan
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry, I would still have to ask where is the recordnumber coming from then? It does have to uniquely identify each record and it is presumably maintained in the server. Should the server generate ids for the records somehow even though they are not stored in the db file?
Thanks.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aruna - Look at the DataInfo class. Do you see any methods there that might help?
Mark
 
Aruna Raghavan
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops, this is what happens when you get the assignment, read it once and don't touch for a few months.
Thanks Mark, I already feel like I am making progress since I came to this site few days ago.
Thanks again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic