mysql sql中文排序 hibernate HQL中文排序
sql:
select chinese from table1 order by convert(chinese using gb2312) asc;
HQL:
public class MySQL5LocalDialect extends MySQL5InnoDBDialect{ //继承链接mysql的类public MySQL5LocalDialect() {super();registerFunction("convert", new SQLFunctionTemplate(Hibernate.STRING,"convert(?1 using ?2)"));}}
<prop key="hibernate.dialect">com.***.util.MySQL5LocalDialect <!--导入上面咱自定义的类--></prop>