By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 745 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

how to convert a query from SQL to HQL(hibernate Query Language)

P: 58
I want to convert the following query from SQL to HQL.
Expand|Select|Wrap|Line Numbers
  2.      student.first_name AS student_first_name,
  3. AS course_name,
  4. AS course_id,
  5.      admission.admission_no AS admission_admission_no,
  6.      attendance.status AS attendance_status,
  7. case WHEN attendance.status=1 THEN 'P'
  8.             WHEN attendance.status=2 THEN 'A'
  9. End as Status,
  10.     count( as Periods,
  11.     count(attendance.status) as Total,
  12.      time_table_item.tt_date AS time_table_item_tt_date,
  13.      attendance.student_batch_id AS attendance_student_batch_id
  14. FROM
  15.      public.time_table_item time_table_item 
  16.      INNER JOIN public.attendance attendance ON = attendance.time_table_item_id
  17.      INNER JOIN public.syllabus_course syllabus_course ON = time_table_item.act_syl_course_id
  18.      INNER JOIN public.course course ON syllabus_course.course_id =
  19.      INNER JOIN public.student_batch student_batch ON attendance.student_batch_id =
  20.      INNER JOIN public.admission admission ON student_batch.admission_id =
  21.      INNER JOIN public.student student ON admission.student_id =
  22.      AND = syllabus_course.course_id
  23. INNER JOIN public.time_table time_table ON time_table_item.time_table_id =
  24. where 
  25.     student_batch.batch_id= $P{Batch} and time_table.level_id= $P{Level} and syllabus_course.course_id = $P{Course} 
  26. group by 
  27., admission.admission_no,time_table_item.tt_date,attendance.student_batch_id,
  28.     student.first_name,attendance.status,
  29. order by
  30., admission.admission_no,time_table_item.tt_date
Can i get the corresponding HQL query for this?
Please help
May 30 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 534
Perhaps this publication will put you on the track.

I don't know whether any conversion tools are available, but look at for what's being developed in this area.
Jun 5 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.