I have a package with similarity functions installed on my Postgres DB. I was calling them using pure SQL on a JDBC, and it was working as expected.
Now I'm trying to refactor my code to use QueryDSL. The first step of the similarity function is set a limit, between 0 and 1, so that only results above that given threshold are returned. I'm trying this way:
NumberExpression<Float> sim = Expressions.numberTemplate(Float.class, "set_limit({0})", "0.2");
query.singleResult(sim);
I get the following error:
java.lang.IllegalArgumentException: No joins given
I know I haven't passed an EntityPath. If I try and use any EntityPath, I get the error:
`[[IllegalStateException: No data type for node: org.hibernate.hql.internal.ast.tree.MethodNode
\-[METHOD_CALL] MethodNode: '('
+-[METHOD_NAME] IdentNode: 'set_limit' {originalText=set_limit}
\-[EXPR_LIST] SqlNode: 'exprList'
\-[NAMED_PARAM] ParameterNode: '?' {name=1, expectedType=null}
]]`
After that, I'd call another DB function, but I guess the solution would be the same.
Is this possible with QueryDSL?