1

我是新来写HQl查询请帮帮我.. 实际上我SQL Query有 5 个表,即COURSE, SKILLSET, TIMETABLE, INTREST,USER

select
 (select count(*) from intrest) AS 
    NoAttends,course.NAME,course.TYPE,user.FIRSTNAME,user.LASTNAME,skill.COURSE_CONT,
   skill.TEACH_EXP,tt.CLASS_DUR,tt.COURSE_DUR,tt.DATE_TIME from COURSE course 
   inner join SKILLSET skill on
   skill.course_id=course.s_id 
   inner join USER user on 
   user.s_id=skill.user_id 
   inner join TIMETABLE tt on
   tt.course_id=course.s_id
   where course.name IN ('course') 
   ORDER BY course.name LIMIT 10;

请帮我?

4

2 回答 2

1

尝试如下所示。. . . .

SELECT t1.col1, t2.col2, t3.col3 
FROM Table1 t1 JOIN t1.someGroupMemebers t2 
JOIN t2.someUser t3 WHERE t3.username = 'blah blah'
于 2012-10-23T10:53:37.160 回答
0

将 JPA 用于 Hibernate 非常容易,例如:

    entityManager.createQuery("select cd from CourseDetailsVO cd join cd.course.keywords k where k.keyword in (:courseName) and cd.startDate between (:sDate) and (:eDate)", CourseDetailsVO.class);
setParameter("courseName", searchVO.getName())..
...

EntityManager 将进行处理..

于 2012-11-14T11:24:05.627 回答