Re: [hibernate-dev] ExtendedBeanManager
Thank you Yoann Implementing the old interface has let me progress. From: Yoann Rodiere To: Benjamin Confino Cc: Hibernate Dev Date: 08/03/2019 16:55 Subject:Re: [hibernate-dev] ExtendedBeanManager Sent by:hibernate-dev-boun...@lists.jboss.org >From your stack trace, it seems that the object you pass to Hibernate ORM is not correctly detected as implementing the ExtendedBeanManager. And actually I just checked, and there seems to be a bug: we require the object to implement the deprecated org.hibernate.jpa.event.spi.jpa.ExtendedBeanManager interface, even though we only need its parent class, org.hibernate.resource.beans.container.spi.ExtendedBeanManager ... I'll create a ticket for that. Until this is fixed, you will need to implement the deprecated org.hibernate.jpa.event.spi.jpa.ExtendedBeanManager. Yoann Rodière Hibernate NoORM Team yo...@hibernate.org On Fri, 8 Mar 2019 at 17:30, Benjamin Confino wrote: > Hello Yoann > > Indeed I have tried that as an experiment, I got the following error when > I did: > > Caused by: java.lang.ClassCastException: Cannot cast class > com.sun.proxy.$Proxy22 to interface javax.enterprise.inject.spi.BeanManager > at java.lang.Class.cast(Class.java:2623) > at > org.hibernate.resource.beans.container.internal.CdiBeanContainerBuilder.fromBeanManagerReference(CdiBeanContainerBuilder.java:72) > > That was more or less what I expected so I didn't think much of it at the > time, but from your email it sounds like this isn't what you'd expect? > > If it helps I'm running with hibernate-core-5.4.1.Final.jar - I'm not sure > what other info will help you but if you let me know I can send it over. > > Regards > Benjamin > > > > > From:Yoann Rodiere > To:Benjamin Confino > Cc: Hibernate Dev > Date:08/03/2019 15:52 > Subject:Re: [hibernate-dev] ExtendedBeanManager > Sent by:hibernate-dev-boun...@lists.jboss.org > -- > > > > Hello, > > It's supposed to work as you described. > > Have you tried making your class implement *only* ExtendedBeanManager? > It should have worked even if your class implements both, but there might > be a bug... As far as I know we only ever pass objects implementing either > BeanManager or ExtendedBeanManager, never both. > > > Yoann Rodière > Hibernate NoORM Team > yo...@hibernate.org > > > On Fri, 8 Mar 2019 at 11:16, Benjamin Confino wrote: > > > Hello > > > > I'm attempting to write a prototype implementation for Hibernate's > > Extended Bean Manager and I seem to have hit a problem. I have placed a > > proxy class that implements both BeanManager and ExtendedBeanManager into > > the property javax.persistence.bean.manager. I can see that the > invocation > > handler for the proxy is being called by hibernate, but there is no call > > to registerLifecycleListener. Instead I see hibernate trying to use the > > bean manager before it has been initialised. > > > > Do I need to do anything extra to configure hibernate? I was under the > > impression that if the object in javax.persistence.bean.manager > > implemented ExtendedBeanManager everything would automatically be > > configured. > > > > Regards > > Benjamin > > Unless stated otherwise above: > > IBM United Kingdom Limited - Registered in England and Wales with number > > 741598. > > Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 > 3AU > > ___ > > hibernate-dev mailing list > > hibernate-dev@lists.jboss.org > > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.jboss.org_mailman_listinfo_hibernate-2Ddev=DwIGaQ=jf_iaSHvJObTbx-siA1ZOg=hl8XiFr1UrTSgyXVc4KO_i51sM3Gyhlu1KZ4TkyseEQ=STnSVK6ZUUx5NZPFf5M9jB5IZG8kYQIeoxuBrVWDxEQ=6RxBUl4H8CyCjq_no_zRYstRtMIcoHHD_6s6driv_yU= > > > ___ > hibernate-dev mailing list > hibernate-dev@lists.jboss.org > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.jboss.org_mailman_listinfo_hibernate-2Ddev=DwIGaQ=jf_iaSHvJObTbx-siA1ZOg=hl8XiFr1UrTSgyXVc4KO_i51sM3Gyhlu1KZ4TkyseEQ=STnSVK6ZUUx5NZPFf5M9jB5IZG8kYQIeoxuBrVWDxEQ=6RxBUl4H8CyCjq_no_zRYstRtMIcoHHD_6s6driv_yU= > > > > Unless stated otherwise above: > IBM United Kingdom Limited - Registered in England and Wales with number > 741598. > Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU > ___ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.jboss.org_mailman_listinfo_h
Re: [hibernate-dev] ExtendedBeanManager
Hello Yoann Indeed I have tried that as an experiment, I got the following error when I did: Caused by: java.lang.ClassCastException: Cannot cast class com.sun.proxy.$Proxy22 to interface javax.enterprise.inject.spi.BeanManager at java.lang.Class.cast(Class.java:2623) at org.hibernate.resource.beans.container.internal.CdiBeanContainerBuilder.fromBeanManagerReference(CdiBeanContainerBuilder.java:72) That was more or less what I expected so I didn't think much of it at the time, but from your email it sounds like this isn't what you'd expect? If it helps I'm running with hibernate-core-5.4.1.Final.jar - I'm not sure what other info will help you but if you let me know I can send it over. Regards Benjamin From: Yoann Rodiere To: Benjamin Confino Cc: Hibernate Dev Date: 08/03/2019 15:52 Subject:Re: [hibernate-dev] ExtendedBeanManager Sent by:hibernate-dev-boun...@lists.jboss.org Hello, It's supposed to work as you described. Have you tried making your class implement *only* ExtendedBeanManager? It should have worked even if your class implements both, but there might be a bug... As far as I know we only ever pass objects implementing either BeanManager or ExtendedBeanManager, never both. Yoann Rodière Hibernate NoORM Team yo...@hibernate.org On Fri, 8 Mar 2019 at 11:16, Benjamin Confino wrote: > Hello > > I'm attempting to write a prototype implementation for Hibernate's > Extended Bean Manager and I seem to have hit a problem. I have placed a > proxy class that implements both BeanManager and ExtendedBeanManager into > the property javax.persistence.bean.manager. I can see that the invocation > handler for the proxy is being called by hibernate, but there is no call > to registerLifecycleListener. Instead I see hibernate trying to use the > bean manager before it has been initialised. > > Do I need to do anything extra to configure hibernate? I was under the > impression that if the object in javax.persistence.bean.manager > implemented ExtendedBeanManager everything would automatically be > configured. > > Regards > Benjamin > Unless stated otherwise above: > IBM United Kingdom Limited - Registered in England and Wales with number > 741598. > Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU > ___ > hibernate-dev mailing list > hibernate-dev@lists.jboss.org > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.jboss.org_mailman_listinfo_hibernate-2Ddev=DwIGaQ=jf_iaSHvJObTbx-siA1ZOg=hl8XiFr1UrTSgyXVc4KO_i51sM3Gyhlu1KZ4TkyseEQ=uiDe53gn7U2NJbNV61E624TnE-C3umU_rNhHkcDS8sY=6lA6rZaAqy_SI2NeT6wPJoFF3xich4FH7DYNDvGTCDo= > ___ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.jboss.org_mailman_listinfo_hibernate-2Ddev=DwIGaQ=jf_iaSHvJObTbx-siA1ZOg=hl8XiFr1UrTSgyXVc4KO_i51sM3Gyhlu1KZ4TkyseEQ=uiDe53gn7U2NJbNV61E624TnE-C3umU_rNhHkcDS8sY=6lA6rZaAqy_SI2NeT6wPJoFF3xich4FH7DYNDvGTCDo= Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU ___ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev
[hibernate-dev] ExtendedBeanManager
Hello I'm attempting to write a prototype implementation for Hibernate's Extended Bean Manager and I seem to have hit a problem. I have placed a proxy class that implements both BeanManager and ExtendedBeanManager into the property javax.persistence.bean.manager. I can see that the invocation handler for the proxy is being called by hibernate, but there is no call to registerLifecycleListener. Instead I see hibernate trying to use the bean manager before it has been initialised. Do I need to do anything extra to configure hibernate? I was under the impression that if the object in javax.persistence.bean.manager implemented ExtendedBeanManager everything would automatically be configured. Regards Benjamin Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU ___ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev