• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

No way to throw DuplicateKeyException

Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I don't know on what condition will the DuplicateKeyException be thrown. because this method is synchronized and the recNo is allocated inside this method.
Posts: 23
Android Scala VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May I quote the the instruction.html to you (no ridicule, I mean it as an honest hint):

This document deliberately leaves some issues unspecified, and some problems unraised. Your ability to think through these issues, in the face of realistically imperfect specifications, and come to a tenable solution is something upon which you are being graded.

My solution is not the raise DuplicateKeyException at all. I have not yet passed so I might be wrong.

Posts: 11604
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't throw a DuplicateKeyException from create method, because there is simply no appropriate key. In a hotel there can be more than 1 room available for the same night with the same characteristics. So when room numbers will be added to the database file, it makes sense to throw the DuplicateKeyException, but at this moment it doesn't. Of course I documented this decision in choices.txt
money grubbing section goes here:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic