EclipseLink on WildFly 8.2.0
WildFly application server uses Hibernate as a default JPA provider. So you can ignore specifying the persistence provider configuration in the persistence.xml file as bellow:
1- Download the EclipseLink JAR file from the bellow Maven repository link:
http://mvnrepository.com/artifact/org.eclipse.persistence/eclipselink/2.6.0
2- Now navigate to the following directory under the WildFly server directory:
<PATH_TO_WILDFLY_DIRECTORY>\wildfly-8.2.0.Final\modules\system\layers\base\org\eclipse\persistence\main
3- Move the EclipseLink JAR file to the above directory and remove the version from the file name, so it would be eclipselink.jar.
4- Add the eclipselink.jar to the <resources> of the module.xml in the mentioned directory.
<?xml version="1.0" encoding="UTF-8"?> <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> <persistence-unit name="BidirectionalPU"> <jta-data-source>java:jboss/datasources/Bidirectional_DataSource</jta-data-source> <class>com.ithinkisink.entity.Child</class> <class>com.ithinkisink.entity.Parent</class> <class>model.TempTable</class> </persistence-unit> </persistence>The deployed application will then use Hibernate as default JPA provider. In order to switch WildFly to use EclipseLink, you can follow the bellow steps:
1- Download the EclipseLink JAR file from the bellow Maven repository link:
http://mvnrepository.com/artifact/org.eclipse.persistence/eclipselink/2.6.0
2- Now navigate to the following directory under the WildFly server directory:
<PATH_TO_WILDFLY_DIRECTORY>\wildfly-8.2.0.Final\modules\system\layers\base\org\eclipse\persistence\main
3- Move the EclipseLink JAR file to the above directory and remove the version from the file name, so it would be eclipselink.jar.
4- Add the eclipselink.jar to the <resources> of the module.xml in the mentioned directory.
<module xmlns="urn:jboss:module:1.3" name="org.eclipse.persistence"> <resources> <resource-root path="jipijapa-eclipselink-1.0.1.Final.jar"/> <resource-root path="eclipselink.jar"/> </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="org.antlr"/> <module name="org.apache.commons.collections"/> <module name="org.dom4j"/> <module name="org.javassist"/> <module name="org.jboss.as.jpa.spi"/> <module name="org.jboss.logging"/> <module name="org.jboss.vfs"/> </dependencies> </module>5- Now you can point the JPA provider to org.eclipse.persistence.jpa.PersistenceProvider.
<?xml version="1.0" encoding="UTF-8"?> <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> <persistence-unit name="BidirectionalPU"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> <jta-data-source>java:jboss/datasources/Bidirectional_DataSource</jta-data-source> <class>com.ithinkisink.entity.Child</class> <class>com.ithinkisink.entity.Parent</class> <class>model.TempTable</class> </persistence-unit> </persistence>
Comments
Post a Comment