I want to get a list sort by some Chinese column with SCHINESE_PINYIN_M, so I write code as following:
session.createSQLQuery("ALTER SESSION SET NLS_SORT=SCHINESE_PINYIN_M");
List accounts = session.createCriteria(Account.class).addOrder(Order.asc("chineseName")).list();
But it doesn't work, so I rewrite the query as following:
accounts = session.createQuery("from Account order by NLSSORT(chineseLegalName,'NLS_SORT=SCHINESE_PINYIN_M')").list();
It works, the problem is I need to alter the session parameter as there are too many places need to sort by Chinese column, What shall I do?
|