-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
16.0.0.Final
-
None
When creating the entity manager factory for eclipseliknk using `javax.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory`, wildfly does not pass the properties required by the jee8 spec, as specified in the javadoc of this method:
If a Bean Validation provider is present in the classpath, the container must pass the ValidatorFactory instance in the map with the key "javax.persistence.validation.factory". If the containing archive is a bean archive, the container must pass the BeanManager instance in the map with the key "javax.persistence.bean.manager"
Debugging the eclipselink implementation of this method, `org.eclipse.persistence.jpa.PersistenceProvider#createContainerEntityManagerFactory`, the properties set by the container contains the following 3 entries:
eclipselink.logging.logger -> org.jipijapa.eclipselink.JBossLogger eclipselink.archive.factory -> org.jipijapa.eclipselink.JBossArchiveFactoryImpl eclipselink.target-server -> org.jipijapa.eclipselink.WildFlyServerPlatform
I think this prevents CDI injection in custom ConstraintValidators, as mentionned on an old eclipselink thread: https://www.eclipse.org/lists/eclipselink-users/msg08503.html.
I have a `ConstraintValidator` with an `@Inject`ed EJB, but when validation is triggered on the call to `javax.persistence.EntityManager#merge`, the injected field is null.
The wildfly installation has been updated to include eclipselink as per documentation:
the org.eclipse.persistence module has been updated to include the eclipselink jar with the following descriptor:
<module xmlns="urn:jboss:module:1.1" name="org.eclipse.persistence"> <resources> <!-- jipijapa line is kept from the original module --> <resource-root path="eclipselink.jar"> <filter> <exclude path="javax/**" /> </filter> </resource-root> </resources> <dependencies> <module name="asm.asm"/> <module name="javax.api"/> <module name="javax.annotation.api"/> <module name="javax.enterprise.api"/> <module name="javax.persistence.api"/> <module name="javax.transaction.api"/> <module name="javax.validation.api"/> <module name="javax.xml.bind.api"/> <module name="javax.ws.rs.api"/> <module name="org.antlr"/> <module name="org.apache.commons.collections"/> <module name="org.dom4j"/> <module name="org.jboss.as.jpa.spi"/> <module name="org.jboss.logging"/> <module name="org.jboss.vfs"/> </dependencies> </module>
The persistence unit provider has been set to `org.eclipse.persistence.jpa.PersistenceProvider` in the persistence.xml file.