Weird situation that does not allow to implement DAO
I've been looking designs to access persistence services with hibernate.
Some elegant solution is to create concrete classes ( DAOs ) that implements some DBPersistenceService for example and interact with those DAOs using DTOs or not ( depends ).
My design is not like that, otherwise the query is hardcoded and is built dinamycally.
I mean, i select clause is hard-coded but the where clause is built dinamically depending on the values that I got from a SearchDTO. I could perform the search by name, lastName, age, etc. so depending on which field comes as a non null value I construct the where clause dinamically.
I think I should do a DAO implementation for hibernate, get the queries from the resources, set the parameters and that's it.
But how to do that if my where clause needs to be built dinamically depending on the values that I get from the DTO which I use to set the query parameters ?
Any design and solution ?
Regards.
Message was edited by:
jfreebsd

