You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Donatas Ciuksys (JIRA)" <ji...@apache.org> on 2017/04/11 08:35:41 UTC
[jira] [Updated] (OWB-1176) IllegalProductException when producer
returns Hibernate SessionImpl object
[ https://issues.apache.org/jira/browse/OWB-1176?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Donatas Ciuksys updated OWB-1176:
---------------------------------
Affects Version/s: 1.7.3
> IllegalProductException when producer returns Hibernate SessionImpl object
> --------------------------------------------------------------------------
>
> Key: OWB-1176
> URL: https://issues.apache.org/jira/browse/OWB-1176
> Project: OpenWebBeans
> Issue Type: Bug
> Components: Core
> Affects Versions: 1.7.2, 1.7.3
> Environment: TomEE 7.0.3
> Reporter: Donatas Ciuksys
>
> 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.
> That contradicts CDI spec. chapter 6.6.5:
> "If a producer method declares a passivating scope and doesn’t only return Serializable types at runtime, then the container must throw an IllegalProductException."
> My example returns object that is instance of Hibernate SessionImpl, that is Serializable type.
> In addition, the example presented in CDI spec. chapter 3.5.2:
> @Produces @ConversationScoped @UserDatabase
> public EntityManager create(EntityManagerFactory emf) {
> return emf.createEntityManager();
> }
> This is not possible with OpenWebBeans. I remember CDI 1.1 spec requiring to check method signatures, but 1.2 no longer says anything about method signatures, CDI must check the object that is being returned.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)