Search code examples
hibernatemavenwildfly-10

How to correctly set up pom with Hibernate Spatial and Widfly 10's JPA implementation?


I had a maven project deployed on WildFly 10.1.0. When I tried to use Hibernate on it, I added its dependency on maven and I stumbled on this. To solve my problem, I used scope provided to make maven look for WildFly's jars instead of downloading on its own as below:

     <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>

But now I want to use Hibernate Spatial within this project. I think standard WildFly javaee-api doesn't contain Hibernate Spatial. Keeping in mind I want to keep Hibernate from javaee-api how can I add Hibernate Spatial on my project?


Solution

  • I recently discovered this blog and with this accomplished what I wanted. The only difference is that my postgres module was added on

    <module name="com.postgresql"/>
    

    and not on

    <module name="org.postgresql"/>
    

    Here's my pom spatial's dependencies:

        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.1.4</version>
            <scope>provided</scope>
        </dependency>
    
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-spatial</artifactId>
            <version>5.0.10.Final</version>
            <scope>provided</scope>
        </dependency>