简体   繁体   English

如何将简单的SQL连接查询转换为HQL

[英]How to convert a simple SQL join query to HQL

I have this query that I need in HQL, but I have found very little help online. 我在HQL中有此查询,但我在网上找不到很少的帮助。

select first_name, last_name, group_id, group_name, status
from users
join groups on groups.id = users.group_id

What would this be if converted to HQL? 如果转换为HQL,该怎么办?

Making a few assumptions: 做一些假设:

select u.first_name, u.last_name, u.group.id, u.group.group_name, u.group.status
from users u

Basically the join is done for you. 基本上,连接已为您完成。 You just reference other objects in the object graph using dot notation. 您只需使用点符号引用对象图中的其他对象。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM