为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】😄 M Database Server 64 V8 DB 版本:0x7000d
【作系统】:KylinSec-Server-3.5.1
【CPU】:AMD EPYC Processor (with IBPB)
【问题描述】*:
技术栈
应用框架:Spring Boot + Groovy
数据访问:Spring Data JPA、Hibernate
jpa配置
spring.jpa.properties.hibernate.dialect=org.hibernate.spatial.dialect.dm.dmgeo2.DmSpatialDialect
spring.jpa.properties.hibernate.default_schema= IAFS
spring.jpa.properties.hibernate.show_sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
spring.jpa.properties.hibernate.naming.implicit-strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
spring.jpa.properties.properties.hibernate.globally_quoted_identifiers=true
spring.jpa.hibernate.ddl-auto=none
spring.jpa.properties.show-sql=true
spring.datasource.druid.validationQuery=SELECT 'x'
spring.jpa.properties.hibernate.query.substitutions=true 1, false 0
spring.jpa.properties.hibernate.generate_statistics=false
spring.jpa.properties.hibernate.max_fetch_depth=2
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false
在实体类中面数据
* 矢量坐标 3857
*/
@Column(name = "geom", columnDefinition = "geometry(Multipolygon,3857)")
Geometry geometry
/**
* 矢量坐标 4326
*/
@Column(name = "geom4326", columnDefinition = "geometry(Multipolygon,4326)")
Geometry geometry4326
在Update操作时 Hibernate 在对比内存中的数据和数据库里的数据(Dirty Checking)发生错误
报错信息
org.springframework.dao.InvalidDataAccessApiUsageException: Only simple geometries should be used; nested exception is java.lang.IllegalStateException: Only simple geometries should be used
at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:371)
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:235)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:551)
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:242)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:152)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:174)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
at com.sun.proxy.$Proxy194.flush(Unknown Source)
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:498)
at org.zeroturnaround.jrebel.integration.springdata.RepositoryReloadingProxyFactoryBuilder$ReloadingMethodHandler.invoke(RepositoryReloadingProxyFactoryBuilder.java:98)
at com.sun.proxy.$Proxy194.flush(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

补充:
尝试通过 nullSafeGet 将数据库中的几何类型转换为Geometry对象
还是报错
如何解析达梦返回的对象