如何在休眠条件中使用group_concat? [英] How to use group_concat in hibernate criteria?

查看:70
本文介绍了如何在休眠条件中使用group_concat?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我像

SELECT c1,group_concat(c2) FROM table1 where sno in(1,4,8,10) group by c1;

并给出我的预期结果.

and gives my expected result.

现在我要使用休眠条件编写相同的查询.

Now the same query I want to write using hibernate criteria.

推荐答案

简单答案是

为什么?

Hibernate仅支持在多个数据库中使用的常用功能/语法. Microsoft SQL Server中没有任何group_concat函数,也可能在其他数据库中.

Hibernate support only common function/syntax used in multiple database. There ain't any group_concat function in Microsoft SQL Server and may be in other database as well.

解决方案:

您必须以简单SQL查询的形式执行它.

You have to execute it as Simple SQL Query.

这篇关于如何在休眠条件中使用group_concat?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆