0

Below is the sql query which will fetch the results which is a combination of many inner joins..and the corresponding pojos are

Table             JAVA POJO
boopUSER          User
booprtyu         rtyu

user.java contains the following properties

updatedby
updatebby
updateddate

rtyu.java contain the following properties

 id;
code;
name;

The query which fetches the record..

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

now could ypu pls advise equivalent hql or criteria for this.Thanks in advance, early help would be appreciated

1 Answers1

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)

Luca Basso Ricci
  • 17,829
  • 2
  • 47
  • 69