title: Save to json postgres : java.lang.UnsupportedOperationException
body: <p>I want to json data save to database but first I need to parse JSON data. I did vector type parser but I could not coordinate.</p>
  
  <p>Example : geoJson</p>
  
  <p><code>{"coordinates":[-48.287108838558,-15.679686963558],"type":"Point"}</code></p>
  
  <p>I saved to vector type.
  my Geojson parse code :</p>
  
  <pre><code>public class GeoJSON{
  
   private String type;
  private String data;
  public String getType() {return type;}
  public void setType(String type) {this.type = type;}
  
  public String getData() {return data;}
  public void setData(String data) { this.data = data; }
  
   public GeoJSON() {
  }
  
  public GeoJSON(JSONObject json) {
      parse(json);
  }
  
  public GeoJSON parse(JSONObject json) {
      StringWriter out = new StringWriter();
      json.write(out);
      this.data = out.toString();
      this.type = json.getString("type");
  
      try {
          out.close();
      } catch (IOException ex) {
          System.out.println(ex.getMessage());
          throw new RuntimeException(ex);
      }
  
      return this;
  }
  </code></pre>
  
  <p>After Mycontroller in insert method :</p>
  
  <pre><code>public boolean insert(GeoJSON item)
  {
  
  SavegeojsonEntity theEvent = new SavegeojsonEntity();
  
      boolean success;
      try {
          String vectorType = item.getType();
          EntityManager em = HibernateSpatialJPA.createEntityManager();
          em.getTransaction().begin();
          theEvent.setVectorType(vectorType);
  
          if(vectorType.equals("Point"))
          {
              Geometry geom = wktToGeometry(item.getData());
              System.out.println("geomPo "+geom);
              theEvent.setGeom((Point)geom);
          }
          em.persist(theEvent);
          em.getTransaction().commit();
          em.close();
          success=true;
          HibernateSpatialJPA.close();
      }
      catch (Exception ex)
      {
          ex.printStackTrace();
          success = false;
      }
      return success;
  }
   private Geometry wktToGeometry(String wktPoint) {
      WKTReader fromText = new WKTReader();
      Geometry geom = null;
      try {
          geom = fromText.read(wktPoint);
      } catch (com.vividsolutions.jts.io.ParseException e) {
          throw new RuntimeException("Not a WKT string:" + wktPoint);
      }
      return geom;
  }
  </code></pre>
  
  <p>My SavegeojsonEntity Class :</p>
  
  <p>Point (com.vividsolutions.jts.geom.*;)</p>
  
  <pre><code> private Point geom;
  @Basic
  @Column(columnDefinition="Geometry",name = "geom", nullable = true, insertable = true, updatable = true)
  @Type(type="org.hibernate.spatial.GeometryType")
  public Point getGeom() {return geom;}
  public void setGeom(Point geom) {this.geom = geom;}`
  </code></pre>
  
  <p>the method inserts</p>
  
  <p><code>System.out.println("geomPo "+geom);
    geomPo = null</code> </p>
  
  <p>because </p>
  
  <p><code>item.getData() value:
  "coordinates":[-48.287108838558,-15.679686963558],"type":"Point"</code></p>
  
  <p>I want to <code>item.getData() value :</code> -48.287108838558,-15.679686963558</p>
  
  <p>This is my stracktrace :</p>
  
  <pre><code>javax.persistence.RollbackException: Error while committing the transaction
  at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:92)
  at com.springapp.model.SavegeojsonManager.insert(SavegeojsonManager.java:55)
  at com.springapp.model.SavegeojsonManager.insert(SavegeojsonManager.java:26)
  at com.springapp.mvc.HSpatialController.saveGeoJson(HSpatialController.java:46)
  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:497)
  at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)
  at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
  at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:781)
  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:721)
  at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)
  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
  at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
  at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
  at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
  at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
  at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2430)
  at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2419)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745)
  Caused by: java.lang.UnsupportedOperationException
  at org.hibernate.spatial.GeometrySqlTypeDescriptor.getBinder(GeometrySqlTypeDescriptor.java:52)
  at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:305)
  at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:300)
  at org.hibernate.type.AbstractSingleColumnStandardBasicType.nullSafeSet(AbstractSingleColumnStandardBasicType.java:57)
  at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2705)
  at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2959)
  at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3403)
  at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:88)
  at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362)
  at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:354)
  at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:275)
  at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326)
  at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)
  at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1214)
  at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:403)
  at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)
  at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)
  at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:75)
  ... 40 more
  </code></pre>
  
  <p>Please.
  Thanks in advance.</p>