title: MySQL geospatial data (POINT) and JPA in Netbeans
body: <p>I need to just fetch some geospatial data (simple coordinates - POINTS) from MySQL db and use them in Java (NetBeans project). This is what I did so far:</p>
  
  <p>Created MySQL db with following table:</p>
  
  <pre><code>CREATE TABLE `test` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `lokacija` point DEFAULT NULL,
    `info` varchar(45) DEFAULT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
  </code></pre>
  
  <p>I also created NetBeans project and set up JPA and everything, added hibernate-spatial library to it and here is my persistence.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
  &lt;persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"&gt;
    &lt;persistence-unit name="testGisPU" transaction-type="RESOURCE_LOCAL"&gt;
      &lt;provider&gt;org.eclipse.persistence.jpa.PersistenceProvider&lt;/provider&gt;
      &lt;class&gt;model.Test&lt;/class&gt;
      &lt;exclude-unlisted-classes&gt;false&lt;/exclude-unlisted-classes&gt;
      &lt;properties&gt;
        &lt;property name="hibernate.dialect" value="org.hibernate.spatial.dialect.mysql.MySQLSpatialDialect"/&gt;
        &lt;property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:8889/dipl?zeroDateTimeBehavior=convertToNull"/&gt;
        &lt;property name="javax.persistence.jdbc.user" value="root"/&gt;
        &lt;property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/&gt;
        &lt;property name="javax.persistence.jdbc.password" value="root"/&gt;
      &lt;/properties&gt;
    &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>After that, created entity and besides all other properties, it also contains following:</p>
  
  <pre><code>    ...
      @Column(name = "lokacija")
      @Type(type="org.hibernate.spatial.GeometryType")
      private Point lokacija;
  
      @Column(name = "info")
      private String info;
      ...
  </code></pre>
  
  <p>I also generated REST facade directly from NetBeans and I tried to print all items I fetch from the db (currently I have only two items with descriptions "first" and "second" and locations (1,1)) and here is what I get:</p>
  
  <pre><code>LOCATION: null
  INFO: first
  
  LOCATION: null
  INFO: second
  </code></pre>
  
  <p>Any suggestions what else I should do in order to make this work?</p>