• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

key field is record number or flight number?

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2545
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I'm THIS CLOSE to ruling the world! Right after reading this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic