tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karl Kildén <karl.kil...@gmail.com>
Subject Re: ViewSscoped JSF bean & stateless that injects entityManager?
Date Thu, 20 Nov 2014 12:53:29 GMT
Hello sorry for what might be stupid questions but are stateless beans
serializable?



On 20 November 2014 12:47, Romain Manni-Bucau <rmannibucau@gmail.com> 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 <karl.kilden@gmail.com>:
> > 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
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message