Jerome, Thanks, did you add it in a finally block so that it always gets executed even if there is an exception.
Paul On 6-Mar-09, at 10:36 AM, Jerome Louvel wrote: > Hi Paul, > > You made a good point regarding the afterSend and beforeSend method. > So, I > decided to change their behavior. Those methods are now invoked all > the > time, even if there is no entity sent (null will be passed). > > Changes in SVN trunk. > > Best regards, > Jerome Louvel > -- > Restlet ~ Founder and Lead developer ~ http://www.restlet.org > Noelios Technologies ~ Co-founder ~ http://www.noelios.com > > > -----Message d'origine----- > De : blackh...@collab.net [mailto:blackh...@collab.net] > Envoyé : jeudi 26 février 2009 17:31 > À : discuss@restlet.tigris.org > Objet : RE: Re: Managing a JPA/Hibernate session > > I have been looking more into the issue and have found some more > additional > issues. > > 1. As you suggested filters do not work as they are completed before > the > response is sent to the client. > 2. The ConnectorService also does not work as the afterSend method > is only > called if there was an entity and there were no IO exceptions in > streaming > the result to the client. The result of this that you will have > dangling > EntityManagers as they are not closed. > > What is required is an interceptor/filter which can wrap the entire > call to > the restlet chain which wraps the handle and commit calls. This > would allow > you to do setup before the restlet calls and cleanup after the > response has > been committed. The developer then can include a finally block so > that the > cleanup is also performed after any exceptions. > > Paul > > ------------------------------------------------------ > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=12337 > 13 > > ------------------------------------------------------ > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1278438 Paul Austin President/CEO Revolution Systems Inc. +1 (604) 288-4304 x201 www.revolsys.com ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1278453