GROUP_CONCAT Hibernate HQL

2019-07-24 12:06发布

问题:

Basically i am trying to write the following query in Hibernate. Please help me to do the same.

SELECT collaboratoruser,GROUP_CONCAT(collaboratorrole SEPARATOR ',') FROM tbl_conceptcollections_collaborator WHERE collectionid = incollectionid GROUP BY collaboratoruser;

I cannot use SQL Query and i want to use only HQL. Any help appreciated.

回答1:

Frank answer is No.

Why so ?

Hibernate supports only common function/syntax used in multiple database's. Moreover, There isn't any group_concat function in MySQL Server and probably could be the same for other database as well.

Solution:

You have to execute it as Native SQL Query only.