java - Hibernate: how to use CONCAT and GROUP_CONCAT -
how can use concat() , group_concat() in hql queries?
about concat: works same way in mysql (it concatenates strings, not aggregate function).
you can add group_concat sql function configuration. way assume underlaying db knows function, , tie program mysql.
import org.hibernate.cfg.configuration; import org.hibernate.dialect.function.standardsqlfunction; import org.hibernate.type.stringtype; // ... myconf.addsqlfunction("group_concat", new standardsqlfunction("group_concat", new stringtype())); you indicate output of function string. without when group_concat numeric fields hibernate assume result numeric , crash.
Comments
Post a Comment