Hi Johan, Johan Compagner wrote: > still why can't you do it on request? > the first time a hibernate connection/transaction is get? > And then close that in the servlet filter?
Agreed, that would be the cleanest way to do, but it may not always be feasible and would need a lot of code and rework for my project. I was just looking for something simpler. Right now my code depends on my existing "WrapInUserTranactionServletFilter" and i wanted to optimize server loadby just *not* applying this filter to the "getFromBufferAfterRedirect" request. > Also you could do this in youre own RequestCycle and do the open/close in > the attach en detach. yep, i was misleaded because the URLs (for the event as well as the redirectToBuffer) look quite similar. In fact IEventProcessorStrategy.processEvents is just called when it is a real event-request (i.e. the first one). So i subclass DefaultEventProcessorStrategy and start my transaction there (only if requestTarget is instanceof ListenerInterfaceRequestTarget or BookmarkablePageRequestTarget or PageRequestTarget, therefore also avoiding transactions for resource-requests). Committing the transaction is done in a subclass of DefaultResponseStrategy. Just wondering what you meant by " do the open/close in the attach en detach."? Rgds, Marco > johan > > > On 4/24/06, Marco Geier <[EMAIL PROTECTED]> wrote: > >>i'm using ejb3/hibernate, and the important part is not really the >>transaction but the entitymanager-context (i.e. the hibernate session) >>wich is somehow bound to the transaction. >> >>The problem here is the handling of lazy loaded collections. >> >>If i don't eager-load (either by declaring them as eager or by >>explicitly referencing while a have a transaction, e.g. from within a >>sessionbean) the collections that may be referenced from a model during >>rendering, hibernate will throw a "LazyInitializationException" in case >>there is no active Transaction/Hibernate-session. >> >>Marco >> >> >>Igor Vaynberg wrote: >> >>>why not only open a transaction when a connection is asked for? >>> >>>what persistence layer are you using? >>> >>>-Igor >>> >>> >>>On 4/23/06, Marco Geier <[EMAIL PROTECTED]> wrote: >>> >>> >>>>I'd like to wrap all the event-handling and renderig stuff with a >>>>transaction. >>>>So one approach would be to define a (Servlet)Filter or modify some >>>>requestcycle settings. But when i use REDIRECT_TO_BUFFER i just want to >>>>wrap the first request (i.e. the processing and rendering part), but not >>>>the second request that just returns the buffer and therefore abviously >>>>doesn't need a transaction. >>>> >>> >>>>From just looking at the requested URL i can't really distinguish these >>> >>>>request, i.e.: >>>> >>>>first (clicked) request:http://127.0.0.1/app?wicket:interface=:4:2:: >>>>redirect request: http://127.0.0.1/app?wicket:interface=:4:4:: >>>> >>>>Is there any hook or something within requestcycle to use for such a >>>>behaviour? >>>>(if not, imho, this would be a really usefull addition to the wicket >>>>API, especially for people using wicket together with hibernate) >>>> >>>>Rgds, >>>> >>>>Marco >>>> >>>> >>>>Dipl.-Ing. Marco Geier >>>>EyeTea GmbH >>>>Germany >>>>phone +49 (0)721 662464-0 >>>>fax +49 (0)721 662464-1 >>>>mobile +49 (0)177 6579590 >>>>[EMAIL PROTECTED] >>>> >>>> >>>>------------------------------------------------------- >>>>Using Tomcat but need to do more? Need to support web services, >> >>security? >> >>>>Get stuff done quickly with pre-integrated technology to make your job >>>>easier >>>>Download IBM WebSphere Application Server v.1.0.1 based on Apache >> >>Geronimo >> >>>>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >>>>_______________________________________________ >>>>Wicket-user mailing list >>>>[email protected] >>>>https://lists.sourceforge.net/lists/listinfo/wicket-user >>>> >>> >>> >>-- >>___________________________ >> >>Dipl.-Ing. Marco Geier >>EyeTea GmbH >>Germany >>phone +49 (0)721 662464-0 >>fax +49 (0)721 662464-1 >>mobile +49 (0)177 6579590 >>[EMAIL PROTECTED] >> >> >>------------------------------------------------------- >>Using Tomcat but need to do more? Need to support web services, security? >>Get stuff done quickly with pre-integrated technology to make your job >>easier >>Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >>_______________________________________________ >>Wicket-user mailing list >>[email protected] >>https://lists.sourceforge.net/lists/listinfo/wicket-user >> > > -- ___________________________ Dipl.-Ing. Marco Geier EyeTea GmbH Germany phone +49 (0)721 662464-0 fax +49 (0)721 662464-1 mobile +49 (0)177 6579590 [EMAIL PROTECTED] ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
