What's best depends on what kind of app you'll build. Be sure to have look at http://www.hibernate.org/42.html.
I prefer the session-per-conversation pattern for the apps I usually do. A first shot at an implementation (still with the session (ab-)used as conversation) can be found at http://kickstart.sourceforge.net . We've started with Spring and session-per-request. But I found the concept of keeping the objects the user currently works with along with the hib-session which loaded them cleanest. It makes hibernate really transparent. You might also have a look at http://wiki.apache.org/jakarta-tapestry/HibernateTapestrySqueezer which automates the loading-from-id approach. It sounds reasonable, but I didn't try it yet. And I'm not sure what it does with ASO's holding persistent domain objects. hth, Marcus > -----Original Message----- > From: Moshiul Shovon [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 11, 2006 1:33 AM > To: Tapestry users > Subject: Best Practice (Hibernate, Spring, Tapestry) > > > Hello: > > I am using Tapestry + Spring + Hibernate (based on Appfuse 1.8.2). > > I had earlier posted a message in the Spring forum: > http://forum.springframework.org/showthread.php?t=21231 > > I was trying to figure out how to transparently re-attach > hibernate sessions to objects saved in the http session. > > After checking various forums, I realized there are probably > few options. Below is one related thread: > > http://www.mail-archive.com/[email protected]/m sg11105.html However, now I have a question about the best practice. Here are two options: 1) Save persistent POJOs in the http session and rettach hibernate session to those POJOs before using them 2) Save only primary keys of persistent POJOs in http session, and reload them on each http request cycle Which approach is better, and why? Orignially, I wanted to use option 1. It seemed natural. For example, If I have a shopping cart, I would have actual Item objects already loaded in the shopping cart, and this cart will be saved in http session (thru Tapestry). In the 2nd option, I would have to store only the primary keys of the Items and use some other methods to the load the objects when displaying or updating them. But, I am willing to go this route if this is the best practice considering how hibernate works. Thanks ... Shovon --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
