Search code examples
javahibernatejakarta-eevaadinvaadin-push

Vaadin 7: Filters, EntityManager per Request(hibernate), JPAContainer and push/websockets usage


I am using Wildfly 8.1 and Vaadin 7.3.beta1.

I am starting an EntityManager in a @WebFilter and managing the transaction at that layer, that is folowing the entitymanager-per-request pattern recommended for the usage of the JPAContainer addon.

Before Vaadin 7 it was clear to me that for every event in the browser that had a listener in the server a simple HTTP Request will be made and it will go through my Filter, thus initiating a transaction before vaadin code gets executed, and properly finishing that entitymanager transaction after vaadin code executed.

But I am concernet now that Vaadin 7 supports push and might use websocket under the hood that my Filter might not allways be executed. Will my filter run regardless of the transport being used when using @Push in the UI?

How does this work in Vaadin 7?


Solution

  • Acording to this answer https://stackoverflow.com/a/24919928/39998 we should not rely in javax.servlet.Filter anymore while using @Push in Vaadin 7 UI's because it might be using websockets as the underlying transport which won't get the filter executed to start the EntityManager Transaction.