473,414 Members | 1,627 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

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

I want to convert the following query from SQL to HQL.
Expand|Select|Wrap|Line Numbers
  1. SELECT
  2.      student.first_name AS student_first_name,
  3.      course.name AS course_name,
  4.      course.id 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(course.id) 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 time_table_item.id = attendance.time_table_item_id
  17.      INNER JOIN public.syllabus_course syllabus_course ON syllabus_course.id = time_table_item.act_syl_course_id
  18.      INNER JOIN public.course course ON syllabus_course.course_id = course.id
  19.      INNER JOIN public.student_batch student_batch ON attendance.student_batch_id = student_batch.id
  20.      INNER JOIN public.admission admission ON student_batch.admission_id = admission.id
  21.      INNER JOIN public.student student ON admission.student_id = student.id
  22.      AND course.id = syllabus_course.course_id
  23. INNER JOIN public.time_table time_table ON time_table_item.time_table_id = 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}   --course.id=9142294     --course.id=9142294 
  26. group by 
  27.     course.id, admission.admission_no,time_table_item.tt_date,attendance.student_batch_id,
  28.     student.first_name,attendance.status,course.name
  29. order by
  30.     course.id, admission.admission_no,time_table_item.tt_date
  31.  
Can i get the corresponding HQL query for this?
Please help
May 30 '07 #1
1 30092
michaelb
534 Expert 512MB
Perhaps this publication will put you on the track.

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

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

Similar topics

2
by: Stan | last post by:
Hello all, I'm looking for some hints as to how to use the results of a query in another query. I assume I'm 'thinking' wrong in how to solve this, so I'm hoping someone can clobber me and send...
1
by: newtechiebug | last post by:
I am trying to convert a MS Access Query to a SQL query and I need help with some IIF Statements? 2 in particular that I've encountered problems with are: Count(IIf(=0 Or...
4
by: Stan | last post by:
I am using MS Office Access 2003 (11.5614). My basic question is can I run a query of a query datasheet. I want to use more that one criteria and can not get that query to work. I thought I...
5
by: manjubhashini19583 | last post by:
Sir, how to write select query and insert query at the same time. I have one database that db having six field. waiting for your reply. thanking you
3
by: robin1983 | last post by:
HI all, how are you ? i need help from you people. This time my problem is that i m running a query inside another query. But, the result that i got is something not exactly what i want. and one...
1
by: finder1977 | last post by:
Act i wrote coding for my project in c language.but the original c coding for my project i was lost cz my PC having problem.Now i got my project code in hex file. So anybody know any software can...
1
by: hridya | last post by:
I am new to hibernate can any one help me to make a hibernate query for ths mysql query select distinct hremployee1_.id as id8_1_ from hr_emp_attendance hrempatten0_ inner join ...
1
by: hergele | last post by:
Hello all.. I am trying to convert an application which is working on Oracle to postgreSql.. I've seen a query in code something like this... select * from table1 a1 , table1 a2, table2 a3, ...
1
by: solutionsville | last post by:
I have a rather complicated query that I need to convert to a Stored Procedure so that I can more easily call this query in an asp.net page. The idea is to have two calander controls on the web...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.