title: Map a PostGIS geometry point field with Hibernate on Spring Boot
body: <p>In my PostgreSQL 9.3 + PostGIS 2.1.5 I have a table <code>PLACE</code> with a column <code>coordinates</code> of type <code>Geometry(Point,26910)</code>.</p>
  
  <p>I want to map it to <code>Place</code> entity in my Spring Boot 1.1.9 web application, which uses Hibernate 4.0.0 + . <code>Place</code> is available with a REST repository.</p>
  
  <p>Unfortunately when I <code>GET http://localhost:8080/mywebapp/places</code> I receive <strong>this strange JSON response</strong>:</p>
  
  <pre><code>{
  
    "_embedded" : {
  
      "venues" : [ {
  
        "id" : 1,
  
        "coordinates" : {
  
          "envelope" : {
  
            "envelope" : {
  
              "envelope" : {
  
                "envelope" : {
  
                  "envelope" : {
  
                    "envelope" : {
  
                      "envelope" : {
  
                        "envelope" : {
  
                          "envelope" : {
  
                            "envelope" : {
  
                              "envelope" : {
  
                                "envelope" : {
  
                                  "envelope" : {
  
                                    "envelope" : {
  
                                      "envelope" : {
  
                                        "envelope" : {
  
                                          "envelope" : {
  
                                            "envelope" : {
  
                                              "envelope" : {
  </code></pre>
  
  <p>and so on indefinetely...! Spring log doesn't help..</p>
  
  <p>I'm working with this application.properties:</p>
  
  <pre><code>spring.jpa.database-platform=org.hibernate.spatial.dialect.postgis.PostgisDialect
  spring.jpa.show-sql=false
  spring.jpa.hibernate.ddl-auto=update
  
  spring.datasource.url=jdbc:postgresql://192.168.1.123/mywebapp
  spring.datasource.username=postgres
  spring.datasource.password=mypwd
  spring.datasource.driverClassName=org.postgresql.Driver
  </code></pre>
  
  <p>First of all, is it ok to use <code>database-platform</code> instead of <code>database</code>?
  And maybe do I have to use following settings instead of the above?</p>
  
  <pre><code>spring.datasource.url=jdbc:postgresql_postGIS://192.168.1.123/mywebapp
  spring.datasource.driverClassName=org.postgis.DriverWrapper
  </code></pre>
  
  <p>Anyway my entity is something like this:</p>
  
  <pre><code>@Entity
  public class Place {
      @Id
      public int id;
      @Column(columnDefinition="Geometry")
      @Type(type="org.hibernate.spatial.GeometryType")    //"org.hibernatespatial.GeometryUserType" seems to be for older versions of Hibernate Spatial
      public com.vividsolutions.jts.geom.Point coordinates;
  }
  </code></pre>
  
  <p>My pom.xml contains this relevant part:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.postgresql&lt;/groupId&gt;
      &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
      &lt;version&gt;9.3-1102-jdbc41&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;4.3&lt;/version&gt;&lt;!-- compatible with Hibernate 4.3.x --&gt;
      &lt;exclusions&gt;
          &lt;exclusion&gt;
              &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
              &lt;groupId&gt;postgresql&lt;/groupId&gt;
          &lt;/exclusion&gt;
      &lt;/exclusions&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>A bit strange configuration, I found it on the internet, it is the one that works best for now.</p>
  
  <p>I hope that someone could help me with this mistery. :)</p>