gpt4 book ai didi

java - 如何在hibernate hql和mysql 5.6.2中使用 "st_distance"?

转载 作者:行者123 更新时间:2023-11-30 06:28:26 25 4
gpt4 key购买 nike

我想使用 hibernate 对距离进行排序,但“st_distance”不起作用。日志:

----- org.hibernate.QueryException: No data type for node: org.hibernate.hql.internal.ast.tree.MethodNode -[METHOD_CALL] MethodNode: '(' +-[METHOD_NAME] IdentNode: 'st_distance' {originalText=st_distance} -[EXPR_LIST] SqlNode: 'exprList' +-[METHOD_CALL] MethodNode: '(' | +-[METHOD_NAME] IdentNode: 'POINT' {originalText=POINT} | -[EXPR_LIST] SqlNode: 'exprList' | +-[DOT] DotNode: 'facilitato0_.c_longitude' {propertyName=longitude,dereferenceType=PRIMITIVE,getPropertyPath=longitude,path={synthetic-alias}.longitude,tableAlias=facilitato0_,className=com.kingox.ins.dao.entity.Facilitator,classAlias=null} | | +-[IDENT] IdentNode: '{synthetic-alias}' {originalText={synthetic-alias}} | | -[IDENT] IdentNode: 'longitude' {originalText=longitude} | -[DOT] DotNode: 'facilitato0_.c_latitude' {propertyName=latitude,dereferenceType=PRIMITIVE,getPropertyPath=latitude,path={synthetic-alias}.latitude,tableAlias=facilitato0_,className=com.kingox.ins.dao.entity.Facilitator,classAlias=null} | +-[IDENT] IdentNode: '{synthetic-alias}' {originalText={synthetic-alias}} | -[IDENT] IdentNode: 'latitude' {originalText=latitude} -[METHOD_CALL] MethodNode: '(' +-[METHOD_NAME] IdentNode: 'POINT' {originalText=POINT} -[EXPR_LIST] SqlNode: 'exprList' +-[PARAM] ParameterNode: '?' {ordinal=0, expectedType=null} -[PARAM] ParameterNode: '?' {ordinal=1, expectedType=null} [select id, name, st_distance(POINT (longitude, latitude),POINT(?,?)) as tmpDistance

最佳答案

Hibernate Spatial 中的距离函数称为 distance,而不是 st_distance

但无论如何 Hibernate Spatial does not support distance对于 MySQL。

关于java - 如何在hibernate hql和mysql 5.6.2中使用 "st_distance"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46623201/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com