As everyone, I am having a lot of simple queries for finding entities by different parameters. I want to create a dynamic way to replace all that finders, by providing entity instance (or some find-oriented subclass) to create dynamic query. I have 2 solutions:
1) using dynamic hql, which doesn't necessary be heavy for maintaince etc - remember that I am talking about all those simple queries without any explicit joins etc.
2) using criteria.
I do not have experience enough to tell which one solution is better. Things I do not like in criteria is that it tights me to the hibernate more than I like and that it, teoretically, breaks dao pattern, and that I can not easily see inner hql. btw, does criteria api creates hql before execution?
10x in advance.
|