Injection takes place directly after the construction of the bean. A session scoped bean is constructed only once per session. The session scope is broader than the request scope.
There can be multiple requests inside one session. The injector wouldn't know which request scoped one it has to inject when there are multiple requests at the moment. There may even be no request at all.
Injection takes place directly after the construction of the bean. A session scoped bean is constructed only once per session. The session scope is broader than the request scope.
There can be multiple requests inside one session. The injector wouldn't know which request scoped one it has to inject when there are multiple requests at the moment. There may even be no request at all.To inject the one in the other, the acceptor has to be of the same or a more narrow scope than the injected object.
Injecting a session scoped bean in a request scoped bean will just work. I'd suggest that you take this route instead. Unrelated to the concrete problem, I'd also suggest to rethink the EJB approach as well.
Do you really need to put the same @EJB on two beans which are aware about each other already? I'd suggest to remove the ContactsFacade from the DetailsBean and just let the DetailsBean delegate the job to the ContactsBean.
Excellent answer as always. – Drew H Feb 11 at 16:12 You're welcome. – BalusC Feb 11 at 16:26 It's still odd though.
I can't inject an EJB into a RequestScoped bean. I took everything out of the picture. Soon as I change to it to SessionScoped it works.
Does this have something to do with Stateless and Stateful EJB's? Thanks. – Drew H Feb 11 at 17:00 Might be related to CDI.
I'm not sure how that works. I work with javax.faces. Bean annotations only.
But why don't you just inject it in ContactsBean only and let the DetailsBean delegate the job to ContactsBean or grab the ContactsFacade by a getter of ContactsBean? – BalusC Feb 11 at 17:04 I'll try that in a few. The main problem is I really need a requestScoped bean and I'm stuck with sessionScoped at this point.
I thought the javax.faces. Bean is being deprecated eventually and it's going to the other annotations? I read an article a little while back about it.
– Drew H Feb 11 at 20:38.
ContactsBean is session-scoped, DetailsBean is request-scoped. You can't inject a request-scope bean into a session-scoped bean. Similarly you can't inject a session-scoped bean into a application-scoped, and so on.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.