Hi, Servlet Filters are not used when sending messages in web socket connection. This is how Servlets work at the moment.
You can use Wicket's IRequestCycleListener's onBeginRequest/onEndRequest. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Tue, Sep 15, 2015 at 4:32 PM, Marco Springer <ma...@glitchbox.nl> wrote: > Hi, > > Using normal requests and long-polling ajax timers to update an interface > works fine with hibernate sessions. > Now I'm trying to implement WebSockets to update small parts of a web > application that come from server side events. I want to get rid of the > long > polling. > > For now I'm only using a @Scheduled annotation to broadcast an event to > all attached clients. As a simple scenario. > > The web application should, in response, update with loading new data > from a database using Hibernate. > > This is where it fails, giving the message: > /Caused by: org.hibernate.HibernateException: No Hibernate Session > bound to thread, and configuration does not allow creation of non- > transactional one here/ > > I know this fails due to the fact that WebSocket events don't go through > the normal filters, e.g. OpenSessionInViewFilter that I'm using. > > > *My question:* > Where can I create a hook where I can start the Hibernate Session the > same way the OpenSessionInViewFilter does? > > If I'm totally off with my thoughts, I'd like to hear that too :) > > Used libraries: > wicket 6.19.0 > wicket-sprint 6.19.0 > wicket-native-websocket-jetty9 6.19.0 > hibernate 3.6.10-Final > springframework 3.2.13-RELEASE > (Why the old Hibernate/Spring versions: haven't had time to migrate yet, > too much to do!) > > Thank you very much in advance. > > Best regards, > Marco Springer > > >