• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Difference between createQuery and createSQLQuery?

 
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One is HQL syntax, the other is SQL syntax.

Read the documentation about HQL queries. It's all there.
 
Of course, I found a very beautiful couch. Definitely. And this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic