• 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

B & S App

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Folks,

This could be my first post here, but I've read many. Very Helpful!

On to the question...

Does any one know, or can anyone guess what the DuplicateKeyException thrown by the create method of the supplied interface is all about?

I just use the position of the record in the file as the key. Are we to use something else? Like the name as the key?
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It was not clear to me also, since in my assignment there was no rule defined for 'primary key'.

If you are uncertain about anything, write that down on your choices document justifying why and what you did.

That's what I did. I can't tell if they took away points from my grade because of that, but I passed


Regards,

Kiev
 
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is (in my assignment at least) no key defined so you can never get a DuplicateKeyException.

It is however conceivable that another database format might have a defined key, so the interface supports the option to throw that exception.
That's often the case with interfaces you get from 3rd parties, they're more generic than you have a need for because you're not the only one coding against them.
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I defined my own composite primary key from the data in my db file, so for me the DuplicateKeyException was actually usable. I realise this is technically outside the scope of the project; I just have a pet hatred for duplicate data

Jeremy
 
Eamonn O'Connell
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cheers for the advice. Documenting it sounds like the way to go...
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic