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

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -