I know the title of this question is not very descriptive, but I didn't know how to better explain the question...
I'd like to know your opinion about a doubt that arised during the implementation of a DAO class.
I'm implementing a CustomerDAO
class that must provide access to related data in my application DB. I've implemented the classic CRUD methods as usual, but now I need to implement some method providing data retrieved used "specific" queries.
I mean something like:
SELECT [...] FROM CUSTOMERS WHERE <CUSTOMER_PROPERTY_1> = 'X' AND <CUSTOMER_SOME_DATE> > ? AND <CUSTOMER_SOME_DATE> < ?
So my question is, what's the right approach or "best-practice" to follow? Implement many specific methods like getCustomersByXPropertyBetweenDates()
or try to generalize query and implement a more "generic" (not in Java-sense) method?
Note I'm using plain JDBC and JdbcTemplate
provided by Spring Framework v 3.1