UNION 到 JPA 查询 [英] UNION to JPA Query

查看:45
本文介绍了UNION 到 JPA 查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 JPA 甚至Criteria Builder"中查询UNION"?

Is it possible to query "UNION" in JPA and even "Criteria Builder"?

我正在寻找示例,但目前还没有结果.

I'm looking for examples, but so far i got no result.

有没有人有任何如何使用它的例子?

Does anyone have any examples of how to use it?

或者是使用本机 sql 吗?

Or would that be with native sql?

推荐答案

SQL 支持 UNION,但 JPA 2.0 JPQL 不支持.大多数联合都可以用连接来完成,但有些不能,还有一些更难用连接来表达.

SQL supports UNION, but JPA 2.0 JPQL does not. Most unions can be done in terms of joins, but some can not, and some are more difficult to express using joins.

EclipseLink 支持 UNION.

EclipseLink supports UNION.

这篇关于UNION 到 JPA 查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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