Hello!
I would like to abstract from the hibernate dependent code by using the DAO pattern. As I understand the pattern, there should be one DAO for each business object. This DAO implements CRUD operations which give access to the data of the business object.
By using this approach, however, a scalar query that returns properties from several classes cannot (efficiently) be implemented anymore. I would have to call one DAO method after another to gather the needed information. (Example: I would like to generate a summary table, that lists some properties of different classes).
If I were to implement a DAO which does not pertain to a particular business object and which implements special queries like these efficiently (using HQL) and gives me the result in a transfer object, would that be bad design?
Thanks a lot!
Jonas
|