This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes find()-method and RecordNotFoundException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "find()-method and RecordNotFoundException" Watch "find()-method and RecordNotFoundException" New topic

find()-method and RecordNotFoundException

mohammad abdellatif

Joined: Aug 29, 2007
Posts: 24
DBMain.find method throws a RecordNotFoundException, Shall i through it to indicate no matched records are found, or shall I return an empty array.

Roel De Nijs

Joined: Jul 19, 2004
Posts: 4910

mohammad abdellatif wrote:Shall i through it to indicate no matched records are found

That's what I did. Others just returned an empty array. So both approaches are fine, don't forget to document your decision in choices.txt

SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
I agree. Here's the link:
subject: find()-method and RecordNotFoundException
Similar Threads
Javadoc: What to document if one exception is caught and another is throwed?
implementing interface methods within another interface method
[B&S] does update() need DuplicateKeyException
urlyBird 1.2.3 - findByCriteria method
static method inside a abstract class?