This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes [URLyBird ]Should find call read? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Reply Bookmark "[URLyBird ]Should find call read?" Watch "[URLyBird ]Should find call read?" New topic
Author

[URLyBird ]Should find call read?

pan zhixiong
Greenhorn

Joined: Nov 13, 2005
Posts: 1
Hi ranchers,
I am wandering whether find should call read, how do you think?
Petr Hejl
Ranch Hand

Joined: Feb 26, 2006
Posts: 68
I've decided to use read in find method. I've got data access class implementing my (not DB.java) data access interface (no find here). And Data.java (implementing DB.java) where find is implemented and uses read. In such case it seems to me you can easily switch to another data access class and/or use decorator pattern. And it is simple

P.
Jason Moors
Ranch Hand

Joined: Dec 04, 2001
Posts: 188
I created an additional private method to read a record



Which returns a null string array if the record is deleted, the main difference being that the RecordNotFoundException is not thrown.

This method is used by the public read method which throws a RecordNotFoundException if the array is null.

Jason.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: [URLyBird ]Should find call read?
 
Similar Threads
B&S: find/search
Subtring extraction
Creating a JMS TextMessage From XML
JPA Optimistic Concurrency for Detached Object
Constructors