JPQL limit 1 row result
In the JPQL query it self it is not possible (like in SQL) to limit the number of results.
Such limit can actually be enforced when executing the JPQL query but Bonita does not do that.
What you can do is to define a JPQL that you know (it is up to you to enforce that) will only return a single result (e.g. filtering on primary key) and choose the "Result type" "Single" in the Studio window that let you create your JPQL query.
Alternatively you can:
- Programmatically run your query in order to limit it to a single result. In a Groovy script: testBusinessClassDAO.testQuery(0, 1).first() // 0 is to get the first page of result, 1 is to limit the result to only 1, first() function is used as running the query will return a list with a single entry and first will return this single object.
- In a REST API call: http://localhost:8080/bonita/API/bdm/businessData/com.company.model.Test...