Hi,
I'm trying to develop my application using Hibernate, but still defining DAO's in order to persist objects.
I use a generic DAO with CRUD operations as "Don't Repeat the DAO" article and "Java Persistence with Hibernate" book suggests, plus a generic findAll() method.
My first question is: is that a good approach? I'm loosing some Hibernate features, such as the distinct load() an get() replaced by read() in my DAO...
Suppose, I need N+1(the default) different fetching strategies in my SomeHibernateDAO; I need to implement N methods such as:
getSomeWithRelated1()
getSomeWithAnotherRelated()
....
getSomeWithIHopeTheLastRelated()
where each one set a different Criteria for joins, in order to mantain a correct DAO pattern implementation?
If so, isn't too dispendious thinking that I could have a lot of views related to my root Some entity...(sorry, but my english is very poor)
A last question what is the best approach for displaying tables data in a jsp? never use lazy loading?
Thanks,
Fabio
|