I'm introducing Spring gently into an existing webapp, and am trying to get my head around certain aspects of it. I've read tutorials showing the creation and use of a data access object (interface and implementations thereof). But what is not clear to me is whether one such DAO is required/desirable for each type of data I might be wanting to persist. For example, the tutorials show a DAO with methods like getProductList and a private inner ProductMappingQuery class. So, would I use that same DAO class for customer and order queries, for example? Or should I have a ProductDAO, a CustomerDAO, an OrderDAO and so on? That is, a matching DAO for each type of object I want to persist (or looked at alternatively, for each table in the DB)? This latter seems the obvious thing, but the tutorials don't go that far.


Reply With Quote