Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • 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 ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

B&S: DuplicateRecordException

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I have a question... so... the method throws a DuplicateKeyException



but, if the primary key is recNo and the create methods returns this number for a new records (my solution appends the record to end of database file), how to possible generate this exception ???

Thanks again, Laura
 
Bartender
Posts: 3648
16
Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In fact the create method shouldn't throw the DuplicateKeyException because the key is the record number. If you don't reuse record number why need to bother. If you do reuse record number, how could you check that name/location etc is the same. Therefore you may ignore this exception. Do document your decision in the choices.txt file.
 
Laura Pecoraro
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

K. Tsang wrote:In fact the create method shouldn't throw the DuplicateKeyException because the key is the record number. If you don't reuse record number why need to bother. If you do reuse record number, how could you check that name/location etc is the same. Therefore you may ignore this exception. Do document your decision in the choices.txt file.



Thanks Tsang

Laura
 
Look! I laid an egg! Why does it smell like that? Tiny ad, does this smell weird to you?
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic