You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Dustin N. Jenkins" <dj...@invoqsystems.com> on 2005/09/07 17:24:29 UTC

Best Practices Question

I'm using Cocoon 2.1.7, Hibernate 3.0.5 and Spring 1.2 to develop a 
fairly big (5000+ classes) web application.  I have a question about 
best practices when moving domain objects from Hibernate through my 
Service Layer to my Presentation Layer. 

In anyone's opinion, when it comes to Hibernate lazy loading, should the 
values of a Domain Object be initialized by the time it reaches the 
Presentation Layer?  More specifically the values that the Presentation 
Layer cares about.  I get a lot of unexpected behaviour when it comes to 
saving the objects after the HTTP Form has been submitted like proxies 
or collections that span more than one open session even though the HTTP 
Request was just created.  I'm using the OpenSessionInViewFilter to 
accomodate lazy loading, but should the Presentation Layer really know 
this much about the Persistence Layer?

I've been thinking a lot about using Web Implementation classes that 
contain only initialized values, then pass those values into the Service 
Layer to saveOrUpdate() the Persistent Object.  It's quite frustrating 
developing around my tools, like Hibernate, but other than using JDBC, 
I'm at a loss as to what to do about it.  Anyone with advice on a 
Cocoon/Spring/Hibernate architecture?

Many thanks,
Dustin


-- 
Dustin N. Jenkins
Application Developer
Invoq Systems, Inc.
AlarmPoint - Guaranteed Event Resolution
#216 - 852 Fort Street
Victoria, BC V8W 1H8
Tel: (250) 380-0304
djenkins@invoqsystems.com <ma...@invoqSystems.com>
http://www.invoqsystems.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Best Practices Question

Posted by Laurent Perez <ha...@gmail.com>.
> I'm using the OpenSessionInViewFilter to
> accomodate lazy loading, but should the Presentation Layer really know
> this much about the Persistence Layer?

There's a very good summary you can read at
http://www.hibernate.org/43.html and also especially at
http://forum.hibernate.org/viewtopic.php?t=927886 (bottom link of the
previous faq, see Christian comments).

In short, there are dependencies in the bad sense, and Hibernate guys
don't think this one is bad.

Laurent
ps: this is not really related to Cocoon ;)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org