handled exception in abstract DAO.

added try catch to handle exceptions.