Re: Tapestry-developer digest, Vol 1 #419 - 7 msgs

"Roberto Saccon" <[email protected]>
Newsgroups gmane.comp.java.tapestry.devel
Message-ID <001d01c29255$40130920$1b22dccb@laptop>
Hi Eric

I am just switching from EJB to Hibernate and I am interested to see how you
implemented that bean and would appreciate if you post that code.
My current very, very simple approach requires for every DB-access a new
Hibernate-session (they are light-weight) and then immediatly commits it.

regards
Roberto Saccon

> Luke-
>
> I created a helper bean to deal with Hibernate Sessions.  One thing I
found
> is that the pageDetach event is not appropriate for committing & closing
> Hibernate Sessions in this type of situation:
>
> **Client End
> -User Fills out & submits a form
>
> **Server Side
> -Form fields values are set in the underlying page class
> -FormSubmit listener method is called in the underlying class
> -FormSubmit method obtains Hibernate Session & stores values
> -FormSubmit method uses cycle.setPage("Success"); to indicate success
>
> At this point, the pageDetach event is *not* raised for the current
> page.  Instead, pageEndRender() is called for the current page and control
> passes to "Success".  Thus, if you want to ensure that your Hib. Session
is
> committed and closed based on a page event, you need to use the
> pageEndRender() event.
>
> I can post the code for my helper class if you are interested - it allows
> you to obtain a session by calling getSession(IRequestCycle) and makes the
> assumption that it can find the SessionFactory as an attribute of the
> current ServletContext.
>
> Cheers,
>
> Eric Everman
>





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.