• 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

my two cents on duplicateKey Exception

 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This has been discussed extensively on the forum. There are three alternative "solutions" (see link below). noneis convencing, since sun doesn't say anything about this ex and these solutions made assumptions to some degree. I try to make less assumption: if passed-in data are all null, then I am sure I won't create it in db and I throw the ex. No other case will throw an ex. I think this assumption is standable. Any comments.


https://coderanch.com/t/184254/java-developer-SCJD/certification/DuplicateKeyException

https://coderanch.com/t/183894/java-developer-SCJD/certification/NX-Duplicate-Key-when-updating

https://coderanch.com/t/183817/java-developer-SCJD/certification/Nx-Documenting-DuplicateKeyException
 
Andy Zhu
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
or the case that the arg has more or less fields than the db.
reply
    Bookmark Topic Watch Topic
  • New Topic