• 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.
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!