title: Received object of type org.postgresql.util.PGobject
body: <p>I can insert geometry data into database from my code, but I can only query the data using an SQL editor, like PGAdmin III. I can't retrieve geometry data back to my code. Every attempt ends up with: "Received object of type org.postgresql.util.PGobject". Even running a simple query to test if two geometry values are equal, I get this error. </p>
  
  <pre><code>2017-09-11 19:04:47,771 WARNING [javax.enterprise.resource.webcontainer.jsf.lifecycle] (default task-37) /welcomePrimefaces.xhtml @46,106 actionListener="#{controlador.testar()}": java.lang.IllegalStateException: Received object of type org.postgresql.util.PGobject: javax.el.ELException: /welcomePrimefaces.xhtml @46,106 actionListener="#{controlador.testar()}": java.lang.IllegalStateException: Received object of type org.postgresql.util.PGobject
      at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:111)
      at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:147)
      at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
      at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:814)
      at javax.faces.component.UICommand.broadcast(UICommand.java:300)
      at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
      at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
      at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:658)
      at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
      at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
      at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
      at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
      at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
      at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
      at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
      at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
      at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
      at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
      at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
      at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
      at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
      at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
      at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
      at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
      at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
      at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
      at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
      at io.undertow.server.Connectors.executeRootHandler(Connectors.java:326)
      at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:812)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)
  Caused by: java.lang.IllegalStateException: Received object of type org.postgresql.util.PGobject
      at org.hibernate.spatial.dialect.postgis.PGGeometryTypeDescriptor.toGeometry(PGGeometryTypeDescriptor.java:123)
      at org.hibernate.spatial.dialect.postgis.PGGeometryTypeDescriptor$2.doExtract(PGGeometryTypeDescriptor.java:87)
      at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:47)
      at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:235)
      at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:231)
      at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:222)
      at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:296)
      at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2840)
      at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1735)
      at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1661)
      at org.hibernate.loader.Loader.getRow(Loader.java:1550)
      at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:733)
      at org.hibernate.loader.Loader.processResultSet(Loader.java:978)
      at org.hibernate.loader.Loader.doQuery(Loader.java:936)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:342)
      at org.hibernate.loader.Loader.doList(Loader.java:2622)
      at org.hibernate.loader.Loader.doList(Loader.java:2605)
      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2434)
      at org.hibernate.loader.Loader.list(Loader.java:2429)
      at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:501)
      at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:371)
      at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216)
      at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1339)
      at org.hibernate.internal.QueryImpl.list(QueryImpl.java:87)
      at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:606)
      at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:483)
      at org.jboss.as.jpa.container.QueryNonTxInvocationDetacher.getResultList(QueryNonTxInvocationDetacher.java:58)
      at br.gov.rio.iplanrio.projetox.controle.Controlador.testar(Controlador.java:121)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at javax.el.ELUtil.invokeMethod(ELUtil.java:311)
      at javax.el.BeanELResolver.invoke(BeanELResolver.java:415)
      at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:256)
      at com.sun.el.parser.AstValue.invoke(AstValue.java:285)
      at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
      at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
      at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
      at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
      at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
      at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
      ... 49 more
  
  2017-09-11 19:04:47,800 SEVERE [javax.enterprise.resource.webcontainer.jsf.context] (default task-37) java.lang.IllegalStateException: Received object of type org.postgresql.util.PGobject
      at org.hibernate.spatial.dialect.postgis.PGGeometryTypeDescriptor.toGeometry(PGGeometryTypeDescriptor.java:123)
      at org.hibernate.spatial.dialect.postgis.PGGeometryTypeDescriptor$2.doExtract(PGGeometryTypeDescriptor.java:87)
      at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:47)
      at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:235)
      at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:231)
      at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:222)
      at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:296)
      at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2840)
      at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1735)
      at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1661)
      at org.hibernate.loader.Loader.getRow(Loader.java:1550)
      at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:733)
      at org.hibernate.loader.Loader.processResultSet(Loader.java:978)
      at org.hibernate.loader.Loader.doQuery(Loader.java:936)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:342)
      at org.hibernate.loader.Loader.doList(Loader.java:2622)
      at org.hibernate.loader.Loader.doList(Loader.java:2605)
      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2434)
      at org.hibernate.loader.Loader.list(Loader.java:2429)
      at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:501)
      at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:371)
      at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216)
      at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1339)
      at org.hibernate.internal.QueryImpl.list(QueryImpl.java:87)
      at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:606)
      at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:483)
      at org.jboss.as.jpa.container.QueryNonTxInvocationDetacher.getResultList(QueryNonTxInvocationDetacher.java:58)
      at br.gov.rio.iplanrio.projetox.controle.Controlador.testar(Controlador.java:121)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at javax.el.ELUtil.invokeMethod(ELUtil.java:311)
      at javax.el.BeanELResolver.invoke(BeanELResolver.java:415)
      at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:256)
      at com.sun.el.parser.AstValue.invoke(AstValue.java:285)
      at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
      at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
      at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
      at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
      at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
      at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
      at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:147)
      at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
      at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:814)
      at javax.faces.component.UICommand.broadcast(UICommand.java:300)
      at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
      at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
      at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:658)
      at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
      at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
      at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
      at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
      at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
      at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
      at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
      at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
      at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
      at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
      at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
      at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
      at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
      at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
      at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
      at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
      at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
      at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
      at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
      at io.undertow.server.Connectors.executeRootHandler(Connectors.java:326)
      at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:812)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)
  </code></pre>
  
  <p>I'm using:
  - Hibernate 5.2
  - PostgreSQL 9.6
  - Postgis 2.3
  - JDBC driver PostgreSQL 42.1.4
  - Wildfly 11 (CR1)</p>
  
  <p>Here is the model class:</p>
  
  <pre><code>import java.io.Serializable;
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import com.vividsolutions.jts.geom.Point;
  import com.vividsolutions.jts.geom.Geometry;
  import com.vividsolutions.jts.geom.LineString;
  import com.vividsolutions.jts.geom.Polygon;
  import javax.persistence.Column;
  
  @Entity
  public class PontodeInteresse implements Serializable {
  
      private static final long serialVersionUID = 1L;
  
      @Id
      @GeneratedValue(strategy = GenerationType.SEQUENCE)
      private Long id;
  
      private String descricao;
  
      @Column(columnDefinition = "geometry(Point,4326)")
      private Point ponto;
  
      @Column(columnDefinition = "geometry(LineString,4326)")
      private LineString linha;
  
      @Column(columnDefinition = "geometry(Geometry,4326)")
      private Geometry geometry;
  
      @Column(columnDefinition = "geometry(Polygon,4326)")
      private Polygon poligono;
  </code></pre>
  
  <p>The POM file:</p>
  
  <pre><code>&lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.primefaces&lt;/groupId&gt;
          &lt;artifactId&gt;primefaces&lt;/artifactId&gt;
          &lt;version&gt;6.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax&lt;/groupId&gt;
          &lt;artifactId&gt;javaee-web-api&lt;/artifactId&gt;
          &lt;version&gt;6.0&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.vividsolutions&lt;/groupId&gt;
          &lt;artifactId&gt;jts&lt;/artifactId&gt;
          &lt;version&gt;1.13&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-spatial&lt;/artifactId&gt;
          &lt;version&gt;5.2.10.Final&lt;/version&gt;
     &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
          &lt;version&gt;5.2.10.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
          &lt;version&gt;5.2.10.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
         &lt;groupId&gt;dom4j&lt;/groupId&gt;
         &lt;artifactId&gt;dom4j&lt;/artifactId&gt;
         &lt;version&gt;1.6.1&lt;/version&gt;
         &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>Inside persistence.xml file, I'm using this dialect property: </p>
  
  <pre><code>&lt;property name="hibernate.dialect" value="org.hibernate.spatial.dialect.postgis.PostgisPG95Dialect"/&gt;
  </code></pre>
  
  <p>PS: I have already tried the PostgisDialect</p>
  
  <p>Finally, the method with a simple test query: </p>
  
  <pre><code>public void testar() {
      try {
          GeometryFactory gf = new GeometryFactory();
  
          LinearRing shell = gf.createLinearRing(new Coordinate[] {
                                      new Coordinate(-43.56006145477295,-22.8861191211294), new Coordinate(-43.55607032775879,-22.8861191211294),
                                      new Coordinate(-43.55607032775879,-22.88279796969916), new Coordinate(-43.56006145477295,-22.88279796969916),
                                      new Coordinate(-43.56006145477295,-22.8861191211294)});
          LinearRing[] holes = new LinearRing[0];
          Polygon polygon = gf.createPolygon(shell, holes);
          polygon.setSRID(4326);
  
          Query q = entityManager.createQuery("from PontodeInteresse where equals(geometry, :geo) = true").setParameter("geo", polygon);
          List&lt;PontodeInteresse&gt; pontos = q.getResultList();            
  
      } catch(Exception e) {
          System.out.println(e.getMessage());
      }//try
  }
  </code></pre>
  
  <p>I'm completely lost here, running out of ideas. Please help.
  Thanks</p>