FLowable using native queries binding the parameters not working

Query

sql = SELECT * FROM ACT_RE_PROCDEF p WHERE p.tenant_id_ = ?

repositoryService
.createNativeProcessDefinitionQuery()
.sql(sql)
.parameter(“1”, “abc1”).list()

Above is not working as expected, its throwing Caused by: org.postgresql.util.PSQLException: No value specified for parameter 1.

what is the value that needs to be passed in the parameter function ?

Thanks

@WelschChristopher or any one else, can you please help me here.

Hey @senthacit,
your query uses the wrong parameter format.
Try some thing like this:

        String sql = "SELECT * FROM ACT_RE_PROCDEF p WHERE p.tenant_id_ =  #{parameterName}";

        repositoryService
                .createNativeProcessDefinitionQuery()
                .sql(sql)
                .parameter("parameterName", "parameterValue").list();

Greetings

Christopher

Thanks a lot @WelschChristopher
This works!!!

@WelschChristopher thanks for swift response for all the questions :slight_smile: