为什么我有org.postgresql.util.PSQLException:错误:遇到无效的字节序标志值?

问题描述 投票:0回答:1

我最近在休眠空间5上工作,遇到了麻烦。当我尝试将我的Geometry数据添加到Postgres时。在提交事务阶段,我遇到了下一个错误:

javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute statement] with root cause
org.postgresql.util.PSQLException: ERROR: Invalid endian flag value encountered.

[我的实体看起来像这样,我已经像以前的帖子中一样配置了相同的问题:

@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "geotable")
@Indexed(index = "geoindex")
public class GeoPointModel implements Serializable {

    @Id
    @GeneratedValue
    @DocumentId
    @Column(name = "point_id")
    private Long id;
    @Field(index = Index.YES, analyze = Analyze.NO, store = Store.YES)
    @FieldBridge(impl = GeoBridge.class)
    @Column(name = "location", columnDefinition = "geometry(Point,4326)")
    private Geometry location;
}

我的依赖项:

dependencies {
    implementation 'org.hibernate:hibernate-core:5.4.5.Final'
    implementation 'org.hibernate:hibernate-spatial:5.4.5.Final'
    implementation 'org.springframework:spring-orm:5.1.5.RELEASE'

    compile group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc', version: '2.1.8.RELEASE'
    compile group: 'org.hibernate', name: 'hibernate-search-orm', version: '5.11.3.Final'
    compile group: 'org.apache.lucene', name: 'lucene-spatial', version: '5.5.5'
    compile group: 'com.spatial4j', name: 'spatial4j', version: '0.4.1'
    compile group: 'com.vividsolutions', name: 'jts', version: '1.13'
    compile group: 'net.postgis', name: 'postgis-jdbc', version: '2.3.0'
}

方言:

dialect=org.hibernate.spatial.dialect.postgis.PostgisPG9Dialect

我输了什么?如何解决?

hibernate hibernate-search hibernate-spatial
1个回答
0
投票

可能是https://hibernate.atlassian.net/browse/HHH-11086?解决方法似乎是使用Point而不是Geometry:https://forum.hibernate.org/viewtopic.php?p=2490324&sid=36d7ee961e6ff5e45e71a8aa613cb469#p2490324

关于一个不太相关的注释,如果您仍在尝试使用Hibernate Search(毕竟,您在此问题中对其进行了标记),请查看@Spatialhttps://docs.jboss.org/hibernate/search/5.11/reference/en-US/html_single/#spatial-indexing。在您的情况下,您只需使GeoPointModel类实现org.hibernate.search.spatial.Coordinates,并在@Spatial(name = "location")上添加GeoPointModel注释。

© www.soinside.com 2019 - 2024. All rights reserved.