Answer the question
In order to leave comments, you need to log in
How to avoid bloated DAO with information retrieval methods?
Hello. I read a lot of information, but did not understand how they act in practice.
I have a DAO, for example to search for articles. Accordingly, the FindById, FindByDate, FindByDateInterval methods, and so on, immediately appear.
I would like to have one Find method, where conditions are magically inserted and a selection is obtained. My project can have both mysql and xml databases. So I would like a solution abstracted from the storage, because DAO is used for this.
Answer the question
In order to leave comments, you need to log in
Pass a filter object to find with fields id, date, etc., some of which will contain a value for filtering, the rest will be null.
We can try to pass not the filter object, but directly the partially filled object template that we are looking for. But then it will be impossible to specify intervals or sets of values.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question