Two Laptop Bag
The moose likes Object Relational Mapping and the fly likes Difference between createQuery and createSQLQuery? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "Difference between createQuery and createSQLQuery?" Watch "Difference between createQuery and createSQLQuery?" New topic
Author

Difference between createQuery and createSQLQuery?

Edward Durai
Ranch Hand

Joined: Oct 09, 2004
Posts: 223
Hi this is edward.

I am using Hibernate with Struts. And I also using DisplayTags for Display sorting and pagination.

My Doubt is what is the difference between
Query and CreateSQLQuery in Hibernate
Using this query 1.Query query = session.CreateQuery("from AuditFinding") , Using Dispaly Tags I have done Sorting, and Pagination Using the Query list.
But Using the below Query

2.SQLQuery query = session.createSQLQuery("select id,shipname,shipcode,fromdate,todate,auditfindingstitle,status,assignedto,priority,updatedby,updateddate from Auditfinding af");,
I was not able to Sorting and Pagination.

Using CreateSQLQuery in hibernate, here all the values are stored in object format.
How can i sort and pagination using displaytags.

Could You tell me what is the problem is.
Thank You


Thank You<br />Edward
Jonathan Huang
Ranch Hand

Joined: Jun 23, 2006
Posts: 35
One is HQL syntax, the other is SQL syntax.

Read the documentation about HQL queries. It's all there.
 
 
subject: Difference between createQuery and createSQLQuery?
 
Threads others viewed
Pagination
Pagination
Display Tag Probs using Struts with Hibernate?
Pagination
Pagination
developer file tools