Answer the question
In order to leave comments, you need to log in
Hibernate, ilike, Russian letters?
Hello. There is the following code:
Restrictions.ilike("lastName", lastName, MatchMode.ANYWHERE);
Answer the question
In order to leave comments, you need to log in
If I understand correctly, then you are not looking for it. Restrictions.like("lastName", "%"+ WORD +"%") In SQL, the like command looks for similarity to a pattern. Masks are allowed in the template. % means any sequence of characters.
I would advise you to start by running all queries without Hibernate, but directly to the database and look at the results. Or read the doc/google about how your DBMS works with character case. For example, Oracle obliges you to specify the same case in the condition as in the database (otherwise it will not find it), and MySQL allows you not to think about it. It is most reliable to bring the registers of characters to a certain predefined state before saving the data in the database (for example, all characters to upper case), and later, when a condition is imposed on the selection, also bring the case of the searched string. If there is already garbage in the database (who both entered it and saved it), then you can create indexes in the desired register, i.e. in the field of the table at random, and in the index on this field everything is in UPPER. Or do update table set field = UPPER(field). In general, first look at the DBMS, and only then at Hibernate ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question