• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

feild question. very confused help plz!

 
xi brian
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the following is my owner field description:

The id value (an 8 digit number) of the customer who has booked this. Note that for this application, you should assume that customers and CSRs know their customer ids. The system you are writing does not interact with these numbers, rather it simply records them. If this field is all blanks, the record is available for sale.


does the above mean i should not consider of using owner field as the key ?

thank you in advance
 
Michael Grossenbacher
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi xi brian

Because this field can be empty, it is not applicable as a primary key.

If your specification is nearly similar to mine, then it is only possible to use the position of the record in the database file as the primary key because no other field, or combination of fields would allow to be used as the pk.

Mike
 
xi brian
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if i use index as the key, then the dupicated exception should never be thrown.

there is no any combination of the fields can be the key , since they all could be dupciated.

so i assume that no key in the record. and no dupicated exception should be thrown
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy, my friend.

I used the record number as the primary key. I mean, this is the parameter I use to delete or update records. Since the record number is the position that the record appears in the database, and records cannot fit the same position, I create the record in the first free position (or in the end, in case of no free positions), return this number, and never throw a DuplicateKeyException.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic