Hi all, I am new to Spring + Hibernate and thinking about the architecture problem when using the Hibernate Criteria.
In my existing small project, I am using 3-layers design (web tier, services and persistance layer). Here, I have a Person model class like this
In the web-layer I would like to let the user to search a list of Person that born before/after a user defined date and with name equals, for example, John. I would like to use the Criteria API in Hibernate, but where should I construct the Criteria ? It seems reasonable to perform it in DAO, however, how can I pass these searching criteria to DAO. If it is built in the services class, it violate the rules that services layer should not aware of persistance layer's implementation.Code:public class Person { String name; Date birthDate; ... }
Could someone can help ? Thanks in advance :roll:


Reply With Quote