Alex Roytman created DELTASPIKE-1281:
----------------------------------------

             Summary: Deltaspike does not pass BeanManager to persistenf 
factory config using "javax.persistence.bean.manager"
                 Key: DELTASPIKE-1281
                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-1281
             Project: DeltaSpike
          Issue Type: Bug
          Components: JPA-Module
    Affects Versions: 1.8.0
         Environment: Deltaspike 1.8, Weld 3.0, Java 8 (JSE) JPA with HIbernate 
5.2.10
            Reporter: Alex Roytman


As the result no injections were working in JPA listeners.
Per specs Persistence UnitFactory expects BeanManager in 
javax.persistence.bean.manager property passed when instantiate it but 
org.apache.deltaspike.jpa.impl.entitymanager.PersistenceConfigurationProviderImpl
 does not pass it

this simple override took care of it but I should not need to do it:


{code:java}
@ApplicationScoped
@Alternative
@Priority(Interceptor.Priority.APPLICATION + 10)
public class CdiAwarePersistenceConfigurationProviderImpl extends 
PersistenceConfigurationProviderImpl implements 
PersistenceConfigurationProvider {
  @Inject BeanManager beanManager;
  @Override public Properties getEntityManagerFactoryConfiguration(String 
persistenceUnitName) {
    final Properties conf = 
super.getEntityManagerFactoryConfiguration(persistenceUnitName);
    conf.put("javax.persistence.bean.manager", beanManager);
    return conf;
  }
}
{code}




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to