[seam-issues] [JBoss JIRA] (SEAMPERSIST-75) Provide a way to intercept method calls from EntityManager

Anthony O. (Reopened) (JIRA) jira-events at lists.jboss.org
Thu Dec 8 03:37:41 EST 2011

     [ https://issues.jboss.org/browse/SEAMPERSIST-75?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anthony O. reopened SEAMPERSIST-75:

Could you just say if the provided patch is a good idea or not ?
> Provide a way to intercept method calls from EntityManager
> ----------------------------------------------------------
>                 Key: SEAMPERSIST-75
>                 URL: https://issues.jboss.org/browse/SEAMPERSIST-75
>             Project: Seam Persistence
>          Issue Type: Feature Request
>    Affects Versions: 3.1.0.Beta4
>            Reporter: Anthony O.
>            Priority: Critical
>             Fix For: 3.1.0.Final
>         Attachments: ManagedPersistenceContextExtension.java.patch
> I'm trying to intercept method calls to {{EntityManager}} in order to make modifications to some entities before persisting them.
> I've tried many ways to do that (see http://stackoverflow.com/questions/8213285/how-to-intercept-methods-of-entitymanager-with-seam-3) but I see that the real problem is that it's not easy to make a proxy behind the {{EntityManager}} bean created by {{org.jboss.seam.persistence.ManagedPersistenceContextExtension}}.
> It seems that a way to do that has been thinked, but cannot be used today. In {{ManagedPersistenceContextExtension.beforeBeanDiscovery}}, a {{Set}} of {{SeamPersistenceProvider}} s is created *BUT* {{org.jboss.seam.persistence.HibernatePersistenceProvider}} is always put in front of all others, so we cannot create our own provider to extend the features of current ones as it is chosen in EE environment which use hibernate (JBoss 7 for instance).
> I think the best way to do that would be to create a {{Producer}} bean and not an instanciable bean, as with CDI we could replace that {{Producer}} with an {{@Observes ProcessProducer}} and a {{setProducer()}} to extend it.
> At the moment, we can only {{@Observes ProcessBean}} on the {{EntityManager}} bean created by Seam Persistence, and do nothing about it as the CDI spec doesn't enable us to ask the container to replace the observed bean with {{ProcessBean}}.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the seam-issues mailing list