How to do a partial search in Hibernate Panache

Viewed 152

I'm trying to do a partial search using Hibernate Panache. I'm building a backend using Quarkus and Kotlin. Now when my frontend gives me a search string I'd like to return all partial results.

I have the following query:

repository.find("firstName LIKE '%?1%'", value)

Now I've tried a couple of variations of this, including one with the .list() method.

Does anyone know how I should handle this?

1 Answers
repository.list( "lower(firstName) LIKE ?1", value.toLowerCase() + "%" );

But if you need more complex full-text queries, I would suggest to have a look at Hibernate Search

Related