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

Reply via email to