Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can i use createSQLquery() method in hibernate

 
venkatakiran nukala
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
.I am working with performance issues in hibernate.when i am using hql i cannot force hints for my query.for example
Query qry = session.createQuery(" select /*+index(p p_nm)*/ p.name from Person p ");
when i am running this i am getting parser exception.
But i need to use hints for my query.Can i use createSQLQuery() method for this purpose.for example
Query qry = session.createSQLQuery(" select /*+index(p p_nm)*/ p.name from Person p ");
By using createSQLQuery() will there be any performance degradation.
anyone please help me.

Thanks,
kiran.
 
Edvins Reisons
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A native SQL query will go straight to the database, so you can put there any SQL syntax that your database understands.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic