Hi,
I'm using db2 as the database and DetachedCriteria for selecting some rows but facing problem while sorting the records. (As usual, there is a java model matching to SampleTable. Assume SampleTable has 3 columns: col1, col2, col3) The varchar column (col3) of the table contains some letters different from English alphabet (such as "ç","ş","ü","ö") The order by clause on col3 results in ordering the results in a weird way. The columns starting with the letters "ç","ş","ü","ö" are listed first and the columns starting with "a","b","c","d" are listed after those records. In fact, in the alphabet we use, "ç" is after "c" and "ş" after "s". So the resulting list is in wrong order..
the suggested solution from IBM is using "collation_key" keyword. The usage is below: SELECT col1, col2, col3 FROM SampleSchema.SampleTable ORDER BY collation_key(col3, 'UCA410_LTR_NO', 2500);
My problem is passing "collation_key(col3, 'UCA410_LTR_NO', 2500)" phrase to hibernate in DetachedCriteria.. How do I pass this parameter/phrase to hibernate? Or any other ideas such as setting locale or using hql or whatever else.. How do I overcome this problem??
|