Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
mysql 8的hibernate空间方言_Mysql_Hibernate_Spring Boot_Dialect - Fatal编程技术网

mysql 8的hibernate空间方言

mysql 8的hibernate空间方言,mysql,hibernate,spring-boot,dialect,Mysql,Hibernate,Spring Boot,Dialect,我使用springboot 2.1,并使用hibernate上一版本的orm。 当我想将数据持久化到db时,我出现以下错误: 数据截断:无法从发送到“几何体”字段的数据中获取几何体对象 @Data @Entity @EntityListeners(AuditingEntityListener.class) public class Province { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) Lon

我使用springboot 2.1,并使用hibernate上一版本的orm。 当我想将数据持久化到db时,我出现以下错误:

数据截断:无法从发送到“几何体”字段的数据中获取几何体对象

@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
public class Province {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    Long Id;

    String name;

    @Column(nullable = false, columnDefinition = "MultiPolygon")
    MultiPolygon multiPolygon;

}
我想问题出在我的方言里

server:
port: 8080

logging:
    level:
        com.mousavi007.serverhavadan: debug
spring:
  mail:
    host: smtp.gmail.com
    port: 587
    username:********
    password: ******
    properties:
      mail:
            smtp:
              auth: true
              starttls:
                enable: true
    protocol: smtp
    default-encoding: utf-8

  datasource:
    url: jdbc:mysql://localhost:3306/havadan
    username: *************
    password: *************
    platform: mysql
  jpa:
    hibernate:
      ddl-auto: update
    database-platform: org.hibernate.dialect.MySQL8Dialect

    database: mysql
    show-sql: true
上一版本hibernate的mysql 8的空间缺陷是什么?

请使用

org.hibernate.spatial.dial.mysql.MySQL8SpatialDialect


您应该使用
org.hibernate.spatial.dial.mysql.MySQL8SpatialDialect
,并使用正确的几何体类型(在本例中为
org.locationtech.jts.geom.MultiPolygon
)<代码>@Column上面的注释
MultiPolygon
字段不是必需的

请参阅更多: