Hibernate cant detect dwithin query on springboot

hey i would like to get some help, i use hibernate 6.5, i followed the documentions and everything, and use jts to add geometeric point to my entity in my project :

@Table(name = "OBJECTS_TBL")
public class ObjectEntity {
	private String objectId;
	private String type;

	private String alias;

	private Boolean active;

	private String createdBy;
	private Point geom;

which complied perfectly as seems below:

    create table objects_tbl (
        active boolean,
        creation_timestamp timestamp(6),
        alias varchar(255),
        created_by varchar(255),
        object_id varchar(255) not null,
        type varchar(255),
        geom geometry,
        object_details clob,
        primary key (object_id)

the problem im dealing with, is that my crud which using this entity, cant i detect st_dwithin

public interface ObjectCrud extends JpaRepository<ObjectEntity, String> {
 @Query("SELECT o"
            + " FROM ObjectEntity o "
            + "WHERE st_dwithin(o.geom, st_point( :lng , :lat) ,:distance )  = true")
Caused by: java.lang.IllegalArgumentException: org.hibernate.query.SemanticException: Cannot compare left expression of type 'java.lang.Object' with right expression of type 'java.lang.Boolean'

my gradle and my proprties:


	implementation 'org.springframework.boot:spring-boot-starter-web'
	implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
	// https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-starter-webmvc-ui
	implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.5.0'
	implementation 'org.springframework.boot:spring-boot-starter-mail'
	implementation 'org.locationtech.jts:jts-core:1.19.0'
	implementation 'org.hibernate.orm:hibernate-spatial:6.5.2.Final'
	runtimeOnly 'com.h2database:h2'
	runtimeOnly 'org.postgresql:postgresql' // note postgresql support
	developmentOnly 'org.springframework.boot:spring-boot-docker-compose' // note docker compose support
	developmentOnly 'org.springframework.boot:spring-boot-devtools'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'
	testRuntimeOnly 'org.junit.platform:junit-platform-launcher' // note test plan management support

im sitll entry level anything can help, thanks :frowning:

The error is caused by Hibernate’s type-checking which tries to prevent you from executing queries we know will cause errors on the database side. In your case, this is happening because you’re using the st_dwithin expression, which is a DB-vendor specific function, which Hibernate doesn’t know about.

To register the function and tell Hibernate about its return type, so that type-checking will work correctly, you can use the org.hibernate.boot.model.FunctionContributor contract: you should create a custom implementor that registers the st_dwithin function through org.hibernate.query.sqm.function.SqmFunctionRegistry and register it as a Java Service.