0

下面是将获取结果的 sql 查询,该结果是许多内部连接的组合。相应的 pojo 是

Table             JAVA POJO
boopUSER          User
booprtyu         rtyu

user.java 包含以下属性

updatedby
updatebby
updateddate

rtyu.java 包含以下属性

 id;
code;
name;

获取记录的查询..

SELECT distinct u.name, u.updated_by, u.updateddate FROM boopUSER u, boopuser_rtyu ug, booprtyu gwhere u.id = ug.user_id and ug.rtyu_id = g.id and u.ACTIVE_FLAG='Y' and g.id not in (10,11) order by u.name

现在可以请ypu为此建议等效的hql或标准。在此先感谢,早期的帮助将不胜感激

4

1 回答 1

0

HQL and Criteria can be applied only to hibernate mapped entity (and related association). Your pojo are not hibernate entity (I think that because classes are not annotated) so the only way is to use native SQL and mapping result to POJO (see Native SQL)

于 2013-08-02T18:31:33.013 回答