-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate Spatial 5 with Wildfly 10
PostPosted: Wed May 18, 2016 7:13 pm 
Newbie

Joined: Wed May 18, 2016 5:26 pm
Posts: 2
Hi
I am having trouble with Wildfly 10 and Hibernate Spatial.

I created a column like this
Code:
@Column(columnDefinition="geometry(Point,4326)")
    private Point locacion;


It seemed to work fine until I added data to this column. When I do this I get
Code:
Caused by: java.lang.IllegalStateException: Received object of type org.postgresql.util.PGobject

So reading tons of confusing blogs and outdated documentation I tried many things.
I found this https://gist.github.com/bjornharrtell/3054462

So I tried adding postgis-jdbc to my module.xml this showed this
Code:
Caused by: java.lang.IllegalStateException: Received object of type org.postgis.PGgeometry


I have no problem adding data or editing data with columns like that. My problem is when I want to display it, if I do something like mylocationDao.getAll();
If that column has no data(when it is null) I have no problem displaying the data.

I know it has to do with the way the libraries are set some how. This is the relevant parts of my dom

Code:
<dependency>
         <groupId>dom4j</groupId>
         <artifactId>dom4j</artifactId>
         <scope>provided</scope>
         <version>1.6.1</version>
      </dependency>
      <dependency>
         <groupId>javax.enterprise</groupId>
         <artifactId>cdi-api</artifactId>
         <scope>provided</scope>
      </dependency>

      <dependency>
         <groupId>org.jboss.spec.javax.ejb</groupId>
         <artifactId>jboss-ejb-api_3.2_spec</artifactId>
         <scope>provided</scope>
      </dependency>

      <dependency>
         <groupId>org.jboss.spec.javax.ws.rs</groupId>
         <artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
         <scope>provided</scope>
      </dependency>

      <dependency>
         <groupId>org.hibernate.javax.persistence</groupId>
         <artifactId>hibernate-jpa-2.1-api</artifactId>
         <scope>provided</scope>
      </dependency>

      <dependency>
         <groupId>org.jboss.spec.javax.transaction</groupId>
         <artifactId>jboss-transaction-api_1.2_spec</artifactId>
         <scope>provided</scope>
      </dependency>

      <dependency>
         <groupId>com.sun.mail</groupId>
         <artifactId>javax.mail</artifactId>
         <scope>provided</scope>
      </dependency>

      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-spatial</artifactId>
         <version>${hibernate.version}</version>
      </dependency>

      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-entitymanager</artifactId>
         <version>${hibernate.version}</version>
      </dependency>
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-core</artifactId>
         <version>${hibernate.version}</version>
         <exclusions>
            <exclusion>
               <artifactId>jta</artifactId>
               <groupId>javax.transaction</groupId>
            </exclusion>
            <!-- Exclude SLF4j to avoid version conflicts (we have 1.6.6, this drags
               in 1.6.1) -->
            <exclusion>
               <groupId>org.slf4j</groupId>
               <artifactId>slf4j-api</artifactId>
            </exclusion>
            <!-- Exclude dom4j to avoid version conflicts (we have 1.6, this drags
               in 1.6.1) -->
            <exclusion>
               <groupId>dom4j</groupId>
               <artifactId>dom4j</artifactId>
            </exclusion>
         </exclusions>
      </dependency>
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-java8</artifactId>
         <version>${hibernate.version}</version>
      </dependency>
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-validator</artifactId>
         <version>${hibernate-validator.version}</version>
         <scope>provided</scope>
      </dependency>


I have add org.postgis.postgis-jdbc 1.5.3 o 1.3.3 or net.postgis.postgis-jdbc 2.1 or 2.2. Should I use net.postgis 2.X , I tried adding them to my pom.xml

Should I try adding hibernate spatial 5.1.0.Final to my wildfly as a module, if so, should I update my wildfly s hibernete from 5.0.7 to 5.1.0 Final.

It is kind of a mess


This is my persistance.
Code:
<?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="webmapper">
      <jta-data-source>java:jboss/webmapperDS</jta-data-source>
      <class>ec.com.mapachedev.webmapper.model.Operativo</class>
      <class>ec.com.mapachedev.webmapper.model.PuntoRuta</class>
      <class>ec.com.mapachedev.webmapper.model.PuntoSector</class>
      <class>ec.com.mapachedev.webmapper.model.TipoTurno</class>
      <class>ec.com.mapachedev.webmapper.model.Turno</class>
      <class>ec.com.mapachedev.webmapper.model.Empresa</class>
      <class>ec.com.mapachedev.webmapper.model.Grupo</class>
      <class>ec.com.mapachedev.webmapper.model.Ruta</class>
      <class>ec.com.mapachedev.webmapper.model.Sector</class>
      <class>ec.com.mapachedev.webmapper.model.Supervisor</class>
      <class>ec.com.mapachedev.webmapper.model.Logger</class>
      <class>ec.com.mapachedev.webmapper.model.Base</class>
      <class>ec.com.mapachedev.webmapper.model.TrackRuta</class>
      <class>ec.com.mapachedev.webmapper.model.UsuariosPorEmpresa</class>
      <class>ec.com.mapachedev.webmapper.model.Reporte</class>
      <properties>
         <property name="hibernate.show_sql" value="false" />
         <property name="hibernate.hbm2ddl.auto" value="update" />
         <property name="hibernate.transaction.flush_before_completion"
            value="true" />
         <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider" />
         <property name="hibernate.transaction.manager_lookup_class"
            value="org.hibernate.transaction.JBossTransactionManagerLookup" />
         <property name="hibernate.dialect" value="org.hibernate.spatial.dialect.postgis.PostgisDialect"/>
      </properties>
   </persistence-unit>
</persistence>


Top
 Profile  
 
 Post subject: Re: Hibernate Spatial 5 with Wildfly 10
PostPosted: Thu May 19, 2016 11:08 am 
Newbie

Joined: Wed May 18, 2016 5:26 pm
Posts: 2
I found the answer it was a dependency issue

http://stackoverflow.com/questions/3550 ... 4#37312814


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.