We often use JPQL statements in conjunction with Hibernate for searching in our application.
While searching for an EMojis in a text column of a MSSQL database we encountered the the problem that the search returned too many results.
SELECT e.description FROM xyz e WHERE e.description like '%the emoji%'
So we did it directly on the DB with the SQL statement
SELECT description FROM xyz WHERE description like N'%the emoji%' COLLATE Latin1_General_BIN2
that worked fine. But if we try to append the COLLATE to the JPQL statement we get the following error
Root cause:
org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: COLLATE near line 13, column 58
Is their an (upcoming) solution for search for an emoji with JPQL, Hibernate and MSSQL ?