How to order Strings with German umlauts in JPQL?

Using java code, you can correctly sort German umlauts using the following:

Collections.sort(list, new Comparator<String>() { Comparator umlautCollator = Collator.getInstance(Locale.GERMAN); public int compare(String o1, String o2) { return umlautCollator.compare(o1, o2); } }); 

I would like to do this in my JPQL statement without using the subsequent sort . Is it possible?

+4
source share
1 answer

You need to make sure your database supports Unicode sorting for the character set you are using, for example. UTF-8. Java ddes is Unicode by default, so the comparator class works.

Presumably your database does not - you are probably using US-ASCII, right?

Restoring your database and transforming your data is a difficult answer.

0
source

Source: https://habr.com/ru/post/1432105/


All Articles