• 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

NX: contractor - DuplicateKeyException

 
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My assignment specifies that the createRecord method throws a DuplicateKeyException but doesn't say how it's generated. I can think of 2 scenarios:
1) the contractor name and location fields together form a primary key for the file, and you're trying to add a duplicate primary key, or
2) you go to create the record but just before you do, some other thread creates a record in the spot you were going to use.
Does anyone else see this differently, and how did you deal with #2 above?
ms
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mike
In my assignment (URLyBird 1.1.3) I can't see how it will ever be thrown. I increment the record numbers on creation (or re-use a deleted one) and don't have anything in the spec to suggest a primary key. I could make up a primary key but don't know if I would be penalised for this, so I just intend to document that it will never be thrown.
Cheers
Gareth.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic