I have a custom created function in postgres , now i'm trying to call the custom method from my code. here is the repository function
@Query(value = "select function('createCluster',:tName,:time,:iPattern)")
boolean createClusterIndex(@Param("tName") String tableName, @Param("iPattern") String indexPattern, @Param("time") LocalDateTime time);
going from this link https://thorben-janssen.com/database-functions/
i even registered by function in postgres dialect
this.registerFunction("createcluster",new StandardSQLFunction("createCluster",new BooleanType()));
but once i run the code
Caused by: org.hibernate.QueryException: No data type for node: org.hibernate.hql.internal.ast.tree.MethodNode
\-[METHOD_CALL] MethodNode: 'function (createCluster)'
+-[METHOD_NAME] IdentNode: 'createCluster' {originalText=createCluster}
\-[EXPR_LIST] SqlNode: 'exprList'
+-[NAMED_PARAM] ParameterNode: '?' {name=tName, expectedType=null}
+-[NAMED_PARAM] ParameterNode: '?' {name=time, expectedType=null}
\-[NAMED_PARAM] ParameterNode: '?' {name=iPattern, expectedType=null}
at org.hibernate.hql.internal.ast.tree.SelectClause.initializeExplicitSelectClause(SelectClause.java:161) ~[hibernate-core-5.3.9.Final.jar:5.3.9.Final]
at org.hibernate.hql.internal.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:1018) ~[hibernate-core-5.3.9.Final.jar:5.3.9.Final]
at org.hibernate.hql.internal.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:786) ~[hibernate-core-5.3.9.Final.jar:5.3.9.Final]
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:677) ~[hibernate-core-5.3.9.Final.jar:5.3.9.Final]
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:313) ~[hibernate-core-5.3.9.Final.jar:5.3.9.Final]
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:261) ~[hibernate-core-5.3.9.Final.jar:5.3.9.Final]
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:271) ~[hibernate-core-5.3.9.Final.jar:5.3.9.Final]
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:191) ~[hibernate-core-5.3.9.Final.jar:5.3.9.Final]
... 106 common frames omitted
what could be the cause of this? how can i resolve this?
questions i have gone through:
Using Spring JPA to setup a Aggregate Function for STRING_AGG with Postgresql for a Group_By
No data type for node: org.hibernate.hql.internal.ast.tree.IdentNode HQL
Write & Call user-defined function in JPQL?
User defined PostgreSQL function in hibernate dialect throws exception