In a multi-layered architecture, the data access layer should hide database foibles. For example, Oracle stores empty strings as null – this should be hidden in the data access layer by specifying function return values appropriately. For example, ensure that the layer never returns a null string: null strings returned from the database should be converted to empty strings.
This layer should contain database code only, no application logic.
When using exceptions, try to keep layer interfaces logical and easy to manage. All exceptions thrown by DAL methods should be derived from a single class (in Java, they could throw SQLException
), and other layers should never throw this exception.