as i know you can store a state on stateless , but this is exactly what the injection does.
avihai, no you can't store state on a stateless session bean, since it doesn't keep a conversational state with the client. The injection mechanism works with the container, not the client. Stateless beans reside in a pool: each time you call a method, one instance is created/drawn from the pool and assigned to the client, but just for the duration of the method invocation. What this means is that you have no guarantee that when you call other methods, you'll be referencing the same instance, maybe yes, maybe not. Note: while developing and with only a client, you might have a "stateful-like" behavior, as there's only one instance in the pool beeing called. This will most likely change in production where there are multiple clients.
Stateless session beans should receive all the needed information either by 1) injection, which you said was not an option for you 2) method params: in your create, find, etc, method, just add the entity manager argument that will be used by the bean
Hope it helps!
PS: Stateless beans can use static private variables, as those will be shared by all instances running on the same classloader
Alejandro<br /> <br />SCJP 5 (SAI)
Note to self: don't get into a fist fight with a cactus. Command this tiny ad to do it: