Re: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-20 Thread Thiago H de Paula Figueiredo
On Wed, 20 Jun 2007 12:17:32 -0300, Michael Sims <[EMAIL PROTECTED]> wrote: Unless I'm mistaken, merge()'ing the same object into two different Sessions isn't any more safe than using update() or lock(), so you still have to deal with thread safety issues when using it. I was just talking

RE: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-20 Thread Michael Sims
Thiago H de Paula Figueiredo wrote: > On Tue, 19 Jun 2007 18:24:10 -0300, Norman Franke <[EMAIL PROTECTED]> > wrote: > >> 1. As Michael noted, they aren't thread safe. >> 2. This really gets to a bigger issue, in that these objects aren't >> valid outside of a session. Once the session closes, they

Re: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-20 Thread Thiago H de Paula Figueiredo
On Tue, 19 Jun 2007 18:24:10 -0300, Norman Franke <[EMAIL PROTECTED]> wrote: 1. As Michael noted, they aren't thread safe. 2. This really gets to a bigger issue, in that these objects aren't valid outside of a session. Once the session closes, they are technically invalid according to what I

Re: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-19 Thread Norman Franke
Either should work, however. On Jun 19, 2007, at 5:32 PM, Michael Sims wrote: carlos f wrote: Unless I am mistaken, which happens all the time, but it appears that the crux of his "thread safety" is, 1) storing detached instances on the client side -- I am assuming that "persists in the cli

Re: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-19 Thread Norman Franke
On Jun 19, 2007, at 4:21 PM, carlos f wrote: Norman Franke wrote: My application only uses detached objects that it persists in the client page for change detection (to determine if the record they were editing changed while they were editing, which I flag as an error.) . . . The first

RE: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-19 Thread Michael Sims
carlos f wrote: > Unless I am mistaken, which happens all the time, but it appears that the > crux of his "thread safety" is, 1) storing detached instances on the client > side -- I am assuming that "persists in the client page" is a reference to > the ClientPropertyPersistenceStrategy Sorry for m

Re: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-19 Thread Norman Franke
On Jun 19, 2007, at 12:08 PM, carlos f wrote: Norman Franke wrote: In my case, my DAO has an "assertUnchanged" method that throws an exception if the two objects differ, e.g. my detached object and the one read from the database. In this case, I tell the user that someone else changed their rec

RE: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-19 Thread carlos f
Michael Sims wrote: > > I don't mean to speak for Norman, but the point of this thread has been > that > detached objects are not thread safe, so if you are going to store them in > the > HttpSession, you have to serialize access to it in order to avoid > potentially trying > to re-attach the sa

RE: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-19 Thread Michael Sims
carlos f wrote: > Why not rely on Hibernate's version support for detached objects and > versioning? [...] > Why clone the detached object graph? Why not have the DAO reattach > it to > the session and save it -- assuming it passes your version check? I don't mean to speak for Norman, but the poi

RE: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-19 Thread Michael Sims
Geoff Callender wrote: > You are right, it's a type of EJB. Your question is all about > plumbing, and what I like about EJB 3 is that it does the plumbing > for you, so only have to think about pages, business services, and > entities. [...] > As you can tell, I am almost as enthusiastic about EJ

Re: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-19 Thread carlos f
Sorry, my questions have nothing to do with Tapestry - put a few things you mentioned piqued my interest. Norman Franke wrote: > In my case, my DAO has an > "assertUnchanged" method that throws an exception if the two objects > differ, e.g. my detached object and the one read from the databa

Re: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-19 Thread Geoff Callender
Hi Michael, You are right, it's a type of EJB. Your question is all about plumbing, and what I like about EJB 3 is that it does the plumbing for you, so only have to think about pages, business services, and entities. In other words, I suspect you'll find it easier than where you're cur

RE: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-18 Thread Michael Sims
Steve Shucker wrote: > The only problem I've seen is if a user tries one of a > few long operations and then changes their mind and clicks on > something else. My filter still waits for the long operation to > complete or timeout (configured to 20 seconds) before beginning the > user's new request

Re: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-18 Thread Steve Shucker
I'm serializing the requests to prevent hibernate from trying to associate an entity with more than one session. Most of the research that led to this approach was done in the hibernate2/tapestry3 days, so some of it may be outdated. I believe the rest of my state is sufficiently thread-safe

Re: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-18 Thread Norman Franke
The main issue with that is getPageService().getLink(false, getPageName()) will return URLs too long for IE for my pages. Other browsers like Safari grind to a near halt with really, really long URLs, too. -Norman On Jun 16, 2007, at 10:03 AM, Thiago H de Paula Figueiredo wrote: Em Fri, 1

Re: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-18 Thread Norman Franke
On Jun 18, 2007, at 11:48 AM, Michael Sims wrote: To persist a detached object, I call a clone() function on all of my DB objects that converts it back to a normal POJO (from whatever Hibernate does to it.) That's a good idea, and I might end up doing the same thing. The only thing I don't

RE: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-18 Thread Michael Sims
Hi Steve, Steve Shucker wrote: > I'm not sure if this will completely solve your problem, but I wrote > my own WebRequestServicerFilter that only applies the > session/transaction wrapping on non-asset requests. Interesting! Thanks for that. There will still be some non-asset requests in my app

RE: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-18 Thread Michael Sims
Hi Geoff, thanks for the response, Geoff Callender wrote: > Do any of these problems exist if you get a session bean to do the > work for you? > > For example, a page to edit the user, using a session bean called > OrderService and an entity bean (using Hibernate if you like, as I > do) called Ord

RE: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-18 Thread Michael Sims
Hi, Thanks for taking the time to respond, this is really helpful information. Norman Franke wrote: > My application only uses detached objects that it persists in the > client page for change detection (to determine if the record they > were editing changed while they were editing, which I flag

Re: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-18 Thread Steve Shucker
I'm not sure if this will completely solve your problem, but I wrote my own WebRequestServicerFilter that only applies the session/transaction wrapping on non-asset requests. public void service(WebRequest request, WebResponse response, WebRequestServicer servicer) throws IOExceptio

Re: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-16 Thread Thiago H de Paula Figueiredo
Em Fri, 15 Jun 2007 19:16:30 -0300, Norman Franke <[EMAIL PROTECTED]> escreveu: The only glitches I noticed is when saving a record (i.e. not rolling back) from a listener and returning another page (i.e. a direct service.) I don't want them to be in the same session, since cached data fr

Re: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-15 Thread Geoff Callender
Do any of these problems exist if you get a session bean to do the work for you? For example, a page to edit the user, using a session bean called OrderService and an entity bean (using Hibernate if you like, as I do) called Order. When you're building the page... IOrderServiceLocal or

Re: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-15 Thread Norman Franke
I should note that I'm using Tapestry 4.0.x for my application. I'm also pretty new to both Hibernate and Tapestry, so this may not be the best. It does, however, seem to work well. My application only uses detached objects that it persists in the client page for change detection (to determ