At 10:37 PM +0100 10/3/05, Adam Hardy wrote:
Has anybody got any experience of using Hibernate pojos with nesting
& lazy loading in their JSPs in an enterprise app? Are there any
caveats?
Yes, you must be quite careful to preserve an open session throughout
the entire view, or to use Hibernate.initialize() on everything which
might otherwise not be initialized. If you're used to transferring
data, then calling initialize() might not be so bad, but really, most
people use the "Open Session in View" pattern to manage a session
using a ServletFilter (or equivalent, google will turn up all the
necessary info on that).
In my experience, there can be some kinks to work out within your
mappings and your access patterns, but so far, I'm happy (of course,
the closer the deadlines come, the more annoyed I may be at the
usually pleasant challenge of solving some new technical puzzles!)
But in my application, I have a very rich object model, and the labor
of copying everything around instead of using it directly seems
extremely tedious. (Note that my typical design strategy would not
have led me to as much concern as you have already demonstrated by
posting this, so YMMV.)
It seems nice and easy to develop especially with JSTL & EL, but I'm
still slightly worried about coupling the view so closely to the
domain model, and potential scalability / robustness issues.
If you use the lazy loading correctly, you probably deal with most
all of the scalability and robustness issues, but again, there is
definitely learning required along the way, so budget time
accordingly or save it for a project when you can.
Joe
--
Joe Germuska
[EMAIL PROTECTED]
http://blog.germuska.com
"Narrow minds are weapons made for mass destruction" -The Ex
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]