Hi check out emf.createEntityManager(SynchronizationType. SYNCHRONIZED)).getClass()
Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <https://blog-rmannibucau.rhcloud.com> | Old Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory <https://javaeefactory-rmannibucau.rhcloud.com> 2017-04-10 22:28 GMT+02:00 DonatasCiuksys <[email protected]>: > Hi, > > I'm using TomEE 7.0.3 WebProfile (thus latest OpenWebBeans) with Hibernate > 5.2.9. I'm trying to write CDI producer for ViewScoped EntityManager: > > @PersistenceUnit > private EntityManagerFactory emf; > > @Produces > @ViewScoped > private EntityManager createJTAViewScopedEntityManager() { > return emf.createEntityManager(SynchronizationType.SYNCHRONIZED)); > } > > Yet at the injection point I'm getting exception: > javax.el.ELException: javax.enterprise.inject.IllegalProductException: > WebBeans producer : createJTAViewScopedEntityManager return type in the > component implementation class : lt.vu.usecases.cdi.JPAResources with > passivating scope @javax.faces.view.ViewScoped must be Serializable > > I don't understand the reason for this exception, because Hibernate returns > instance of class "SessionImpl" (as can be seen with debugger), and this > class implements Serializable. What is the problem? > > > > -- > View this message in context: http://tomee-openejb.979440.n4.nabble.com/ > IllegalProductException-return-type-must-be-Serializable-for-Hibernate- > SessionImpl-tp4681517p4681518.html > Sent from the TomEE Dev mailing list archive at Nabble.com. >
