如您所链接的问题和Hibernate文档中所述,实体之间的使用关联被联接。所以正确的查询是
select avg(t.price) from Ticket t join t.flight f where f.number = :flightNumber
Also note that using parameters is a much better solution than concatenating
values directly in the query. It handles quoting and escaping automatically,
and doesn’t have any risk of HQL injection.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)