重写hibernate方言
package com.ayu.hibernate.test;
import org.hibernate.Hibernate;
import org.hibernate.dialect.MySQLDialect;
import org.hibernate.dialect.function.StandardSQLFunction;
public class AyuMySQLDialect extends MySQLDialect {
protected void registerVarcharTypes() {
registerFunction("group_concat", new StandardSQLFunction("group_concat",Hibernate.STRING));
}
}
<prop key="hibernate.dialect">com.ayu.hibernate.test.AyuMySQLDialect</prop>
hql语句:select f.fid,group_concat(f.fname) from Fund f group by f.user.uid