According to my understanding, Seam wraps each request into a Transaction. My web app (code into some seam stateful beans) is at the moment calling some EJB interface which is part of an application server, which also serves a desktop client (an whole complete server application providing all features I need for my web app).
Now, making subsequent calls from seam beans to those ejb methods is wrapped into its own transaction by the Seam container, thanks, but no 'flush' in between is happening, meaning the entity manager does not return to me up to date data on the subsequent calls.
I worked around that by simply adding some methods into the ejb classes which themselves create a new Transaction (forcing the 'flush' at the end of their execution). I'm happy with NOT rolling back everythin开发者_JS百科g if on step went wrong. I can't find anywhere how to maybe configure Seam to wrap the execution of EACH ejb calls into a transaction instead of wrapping the WHOLE request execution.
Any idea ?
Well, Seam wraps each requests into two transactions (an extra read-only transaction for JSF render response). You can disable this behavior by disabling Seam's transactions management, but this would open the gate for all kind of lazy initialization exceptions...
In the (rare) cases when this problem occurred to me, I usually executed a manual flush / refresh on the EntityManager. In most cases the data manipulated by different methods should be separated by it's nature, however
精彩评论