|
- Yes. There is probably no need to implementer try and catch if customer not found. The try and catch I'm referring to is more like a sql failure exception. - DL normally has different search function. Example: customer.findByUniqueID(123456), or customer.findByWhereClause("Name like '%Lim%'"). It probably make sense to let DL handle connection object if doing customer.findByUniqueID. However, how can you do that if doing findByWhereClause? It could return thousands of records which require caller to do rs.next. I don't think you can do rs.next after the connection closed. -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Walden H. Leverich Sent: Wednesday, March 15, 2006 10:05 AM I'm in a C# mindset, I don't need to declare the exceptions that are thrown. You're correct, I'm assuming the DL would throw an exception if the customer wasn't found. However, I might not catch it, it all depends on whether I can do anything about it. Let's say it was a fatal error is customer 12345 wasn't found, why bother catching the exception and then throwing another, just let this exception bubble up the tree. >Also the data layer would probably require a connection to be opened >and closed with consumer is done with it. I allow the DL to manage the connections. The connection is opened at the last minute, used and then closed. The consumer doesn't need the connection object. Besides, if the consumer has the connection object then the consumer has a pathological coupling to the database. Why assume that there is a connection involved at all, perhaps the Customer object doesn't access a database, but instead makes a web-service call. The consumer shouldn't know or care.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.