title: Hibernate-Spatial, JPA, Spring, MySQL 5.7 (unable to retrieve Point)
body: <p>I'm using the frameworks as stated in the topic.</p>
  
  <p>this is my part of my jpa properties in application.yml for spring</p>
  
  <pre><code>jpa:
    database: mysql
    hibernate:
      naming:
        physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl 
    properties:
      hibernate:
        dialect: org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect
        globally_quoted_identifiers: true
    show-sql: true
  </code></pre>
  
  <p>I'm not sure if this is the right way to trigger SpatialDialect for MySQL5.7</p>
  
  <p>My entity's method for Point</p>
  
  <pre><code>@Type(type = "com.iheartcity.apiapp.geometry.MySQLGeometryType")
  @Column(name = "location", nullable = false)
  public Point getLocation() {
      return this.location;
  }
  public void setLocation(Point location) {
      this.location = location;
  }
  </code></pre>
  
  <p>I created a class MySQLGeometryType.java:</p>
  
  <pre><code>package com.iheartcity.apiapp.geometry;
  
  import org.hibernate.spatial.JTSGeometryType;
  import org.hibernate.spatial.dialect.mysql.MySQLGeometryTypeDescriptor;
  
  public class MySQLGeometryType extends JTSGeometryType {
  
      public MySQLGeometryType() {
          super(MySQLGeometryTypeDescriptor.INSTANCE);
      }
  }
  </code></pre>
  
  <p>With the @Type(type = "com.iheartcity.apiapp.geometry.MySQLGeometryType")</p>
  
  <p>it works perfectly. However, when I commented it, I start to get error when running the code to retrieve the data.</p>
  
  <p>Here is the exception:</p>
  
  <pre><code>java.io.StreamCorruptedException: invalid stream header: 00000000
      at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:808) ~[na:1.8.0_111]
  at java.io.ObjectInputStream.&lt;init&gt;(ObjectInputStream.java:301) ~[na:1.8.0_111]
  at org.hibernate.internal.util.SerializationHelper$CustomObjectInputStream.&lt;init&gt;(SerializationHelper.java:309) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.internal.util.SerializationHelper$CustomObjectInputStream.&lt;init&gt;(SerializationHelper.java:299) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.internal.util.SerializationHelper.doDeserialize(SerializationHelper.java:218) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.internal.util.SerializationHelper.deserialize(SerializationHelper.java:287) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.fromBytes(SerializableTypeDescriptor.java:139) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:114) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:28) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.type.descriptor.sql.VarbinaryTypeDescriptor$2.doExtract(VarbinaryTypeDescriptor.java:60) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:47) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:258) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:254) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:244) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:327) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2775) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1741) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1667) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.loader.Loader.getRow(Loader.java:1556) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:740) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.loader.Loader.processResultSet(Loader.java:985) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.loader.Loader.doQuery(Loader.java:943) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:349) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.loader.Loader.doList(Loader.java:2615) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.loader.Loader.doList(Loader.java:2598) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2430) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.loader.Loader.list(Loader.java:2425) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:502) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:371) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1458) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1426) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1398) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
  at org.hibernate.Query.getResultList(Query.java:417) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:808) ~[na:1.8.0_111]
  </code></pre>