hql:与 Map的内连接以及 select 中的访问键和值?

发布于 2024-10-09 12:41:39 字数 732 浏览 6 评论 0原文

这是一个问题:

    public class Company
    {
            private Map<Location, Manager> locationManagerMap;
    } 

一个地点只有一名经理。经理可以与多个位置相关联。

    public class Assignment
    {
            private Location location;
            private Manager
    } 

现在假设我想通过使用带有子查询的 hql 查询来检索公司的所有分配列表,如下所示。

    String query = "select from Assignment as assignment where (assignment.location, assignment.manager) in (select locationManager._____________ from Company as company inner join  company.locationManagerMap as locationManager where company.id=?) "

在上面查询的子查询中,company 与 locationManagerMap 内连接。我想访问此映射的键和值以执行多列条件检查。请建议查询中空格中的语法应该是什么?

Here is problem

    public class Company
    {
            private Map<Location, Manager> locationManagerMap;
    } 

A location has only one manager. A manager can be associated to many locations.

    public class Assignment
    {
            private Location location;
            private Manager
    } 

Now suppose i want to retrieve list of all of assignments for a company by using hql query with subquery some thing like as below.

    String query = "select from Assignment as assignment where (assignment.location, assignment.manager) in (select locationManager._____________ from Company as company inner join  company.locationManagerMap as locationManager where company.id=?) "

In subquery of query above, company is inner joined with locationManagerMap. I want to access key and value of this map to perform multiple column condition check. Please suggest what should be syntax in blanks in query?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

表情可笑 2024-10-16 12:41:39

它应该是这样的:

... index(locationManager), locationManager ...

It should be something like this:

... index(locationManager), locationManager ...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文