A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Developer Certification (SCJD/OCMJD)
when to throw DuplicateKeyException
Joined: Nov 25, 2007
Mar 05, 2008 11:04:00
in my create() of the interface, it throws
When should this be throw?
Joined: Feb 26, 2008
Mar 05, 2008 12:56:00
Depends. In my code: never.
Joined: Feb 17, 2007
Mar 05, 2008 14:08:00
It depends the meaning you give to the record key.
One option is to consider the record key to be the record number. The
is never thrown in that case (record numbers are all
Another option is to consider a subset of the record data as the key. For
example, contractor name + contractor location. But in that case, the update
method should throw the same exception.
This is really a matter of design choice.
[ March 05, 2008: Message edited by: Gilles Marceau ]
SCJP 1.5<br />SCJD 1.6<br />SCBCD in progress...
I agree. Here's the link:
subject: when to throw DuplicateKeyException
UrlyBird: When will the create() method throw DuplicateKeyException ?
Primary key and update method strange issue
NX: Home contractor assignment, update()/create(), DuplicateKeyException
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014