I have a question about designing a webapp to use a DAO layer, lazily
loaded objects, Hibernate, and the OpenSessionInView technique.
Doesn't this strategy make it very difficult to reimplement the DAO
layer sometime in the future? If you switched a DAO
implementation from Hibernate to let's say, Spring JDBC, then how would
all the lazy loading work? There would be no equivalent
OpenSessionInView technique for Spring JDBC. For this reason, I
have been shying away from designing my domain objects such that the
rest of the app expects them to lazily load data.
So, instead of a Company class having a getEmployees() method, I would
choose, instead, to have a CompanyDao.getEmployees(Company company)
method that must be called at the point my webapp needs all the
Employees for a Company.
Have any of you had the same concerns? Or am I missing how a
webapp that relies on lazy-loaded object graphs can change DAO
implementations easily?
-Ken
- Re: JSF + Spring + Hibernate Ken Weiner
- Re: JSF + Spring + Hibernate Larry Meadors
- Re: JSF + Spring + Hibernate Werner Punz
- RE: JSF + Spring + Hibernate Joshua Davis
- Re: JSF + Spring + Hibernate Werner Punz
- RE: JSF + Spring + Hibernate Joshua Davis
- Re: JSF + Spring + Hibernate Ken Weiner
- Re: JSF + Spring + Hibernate Werner Punz
- Re: JSF + Spring + Hibernate Werner Punz
- Re: JSF + Spring + Hibernate Richard Wallace
- RE: JSF + Spring + Hibernate Joshua Davis