stateless != state-less ;). Stateless bean have can have a thread safe state. You just don't know which instance you get.
Romain Manni-Bucau @rmannibucau http://www.tomitribe.com http://rmannibucau.wordpress.com https://github.com/rmannibucau 2014-11-20 14:17 GMT+01:00 Jean-Louis Monteiro <[email protected]>: > Because of clustering, passivation, etc... > > -- > Jean-Louis Monteiro > http://twitter.com/jlouismonteiro > http://www.tomitribe.com > > On Thu, Nov 20, 2014 at 2:15 PM, Karl Kildén <[email protected]> wrote: > >> Why would you want your stateless to be serialized? Still not very used of >> using EJB so for me it it's not intuitive because there's no state? >> >> On 20 November 2014 14:09, Romain Manni-Bucau <[email protected]> >> wrote: >> >> > all EJBs are >> > >> > >> > Romain Manni-Bucau >> > @rmannibucau >> > http://www.tomitribe.com >> > http://rmannibucau.wordpress.com >> > https://github.com/rmannibucau >> > >> > >> > 2014-11-20 13:53 GMT+01:00 Karl Kildén <[email protected]>: >> > > Hello sorry for what might be stupid questions but are stateless beans >> > > serializable? >> > > >> > > >> > > >> > > On 20 November 2014 12:47, Romain Manni-Bucau <[email protected]> >> > wrote: >> > > >> > >> Hi >> > >> >> > >> EntityManager is not serializable (its contract) so it can't be >> > >> injected in a passivation capable bean. fact it works with transent >> > >> field is cause it is serializable then. >> > >> >> > >> IIRC CDI 1.1 relaxed a bit it enforcing implementation to be >> > serializable. >> > >> >> > >> >> > >> >> > >> Romain Manni-Bucau >> > >> @rmannibucau >> > >> http://www.tomitribe.com >> > >> http://rmannibucau.wordpress.com >> > >> https://github.com/rmannibucau >> > >> >> > >> >> > >> 2014-11-20 11:39 GMT+01:00 Karl Kildén <[email protected]>: >> > >> > Hello, >> > >> > >> > >> > Using TomEE 1.7.1 with JSF 2.2 I have a problem. Basically I have a >> > bean >> > >> > with javax.faces.view.ViewScoped and a Stateless that injects >> > >> > EntityManager. I use Eclipselink. >> > >> > >> > >> > This is my producer: >> > >> > >> > >> > public class EntityManagerProducer { >> > >> > >> > >> > @PersistenceContext(unitName = APP_NAME) >> > >> > private EntityManager entityManager; >> > >> > >> > >> > @Produces >> > >> > @RequestScoped >> > >> > protected EntityManager createEntityManager() { >> > >> > return this.entityManager; >> > >> > } >> > >> > } >> > >> > >> > >> > >> > >> > Passivation capable beans must satisfy passivation capable >> > dependencies >> > >> > happens pointing out my JSF bean. If I use private transient >> > >> EntityManager >> > >> > em; it works but it feels strange. >> > >> > >> > >> > Any ideas? >> > >> > >> > >> > >> > >> > cheers >> > >> >> > >>
