-
1. Re: Injecting EntityManager with an interceptor
sbalmos Jul 7, 2006 9:49 AM (in response to sbalmos)Yet again answering myself...
See http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3953596
But seriously, like the original poster in that thread, why must I create a separate remote endpoint interface for the interceptor to be called? It shouldn't be necessary.
--Scott -
2. Re: Injecting EntityManager with an interceptor
lucluc Jul 7, 2006 12:46 PM (in response to sbalmos)Are you sure you are interested in having the EntityManager created the first time the factory (singleton) is created? And then using that EM instance? I don't think EM is thread safe.
I had the same decision to take some time ago, and I preferred to pass EM as parameter to DAO class when calling static method. Doing so, I'm sure to pass the EM private to current thread.
More: I create a bunch of EM in my interceptors and I store them in threadlocal variables so to get visibility both in other interceptors and bean.
Every piece of code gets what it needs and passes it to DAO.
It's useful to put jboss classes on debug level in log4j conf. Doing that you could have a look at EM lifecycle.
Tell me what you think.
bye
F