How the sort order (in queries) works for non english letters?

#1

We are considering using ObjectDB in  project where target audience are czech speaking people (we are Czech company). How the sort order works for international (for us 'czech') letters? Does the ordering respects the national requirements?

Thank you for clarification ...

 
 

 

#2

ObjectDB uses the ordinal Java String lexicographical order, which is based on the order of the characters in Unicode. In Unicode, ordinary English letters are located separated from other language letters.

You can change this behavior by normalizing your strings. You should store your strings in the database normalized, if possible. Normalizing the strings only during sort is also possible, but it is less efficient, of course.

See also this forum thread for more information on normalizing strings and for sample code (but notice that the code in that thread demonstrates the less efficient solution of normalizing the strings during sort).

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#3

 

How about support for Collation?

http://download.oracle.com/javase/tutorial/i18n/text/locale.html

Would be nice if one could just specify they locale as part of the index definition or the ORDER BY clause, so the sort uses the correct collation per defined locale.

#4

Thank you for this useful link.

It makes sense to add index definition support to JPA and include also support of different types of indexes. Hopefully this will be included in a future version of JPA and then also in ObjectDB.

Meanwhile, the string normalization solution has the advantage of being portable.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#5

 

In general, people don't require JPA to support this, because they can configure the RDBMS to select the proper collation sequence. So I wonder if JPA will ever support this. Also, in an RDBMS, you can specify the default collation when you create your database. That by itself might already be sufficient, since most international customers probably just use one collation sequence anyhow. Maybe some property one could set when creating a new ObjectDB datafile?

#6

This is a good point and a productive suggestion.

I created a new feature request. You may subscribe to it and write additional comments regarding this feature request, if any. 

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login