there are some missing up with understanding the difference between the Native Named Query and Native Query and HQL , and a lot of headache about the the performance issue in using them.
What is the Difference between Native Query and Named Native Query :
here I will give a short notice about the difference between them
Native Query : the developer is writing a native SQL query. and has and i'ts dynamic query , it's compiled and execute in run time and will be validated each time the query is executed.
Name Native Query : the scope is persistence ontext and can be used in the application by Specifying the Identity , and it is ready defined and Compiled once , and it's of course static statement.
they are validated only once, at the server startup
Regarding the Difference between HQL statements and Native Statements
Native SQL is not necessarily faster than HQL. HQL finally also is translated into SQL (you can see the generated statement when running the application with the
show_sql
property set to true).
In some cases it can happen Hibernate / JPA does not generate the most efficient statements, so then native SQL can be faster
Pros and Cons Of using HQL :
Pros:
- Hibernate/JPA handle the intricacies of converting the HQL into the various SQL dialects( if you write native SQL , you will lose the portability from DB to another and need to change your statements.because)
- with native SQL you're missing the Hibernate cache - as a consequence in some cases native SQL can be slower than HQL.
Cons:
- In some cases it can happen Hibernate / JPA does not generate the most efficient statements, so then native SQL can be faster
What are the main differences between HQL/JPQL and Criteria ? | ||
|
Nice Hibernate Tutorials for Beginners Java Proficiency
ReplyDeleteI found your blog while searching for the updates, I am happy to be here. Very useful content and also easily understandable providing.. Believe me I did wrote an post about tutorials for beginners with reference of your blog.
ReplyDeleteSelenium Training in Chennai Tamil Nadu | Selenium Training Institute in Chennai anna nagar | selenium training in chennai velachery
Selenium Training in Bangalore with placements | Best Selenium Training in Bangalore marathahalli
java training in chennai | java training in chennai Velachery |java training in chennai anna nagar
Nice tutorial. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful. Keep sharing on updated tutorials…
ReplyDeleteSelenium Training in Chennai Tamil Nadu | Selenium Training Institute in Chennai anna nagar | selenium training in chennai velachery
Selenium Training in Bangalore with placements | Best Selenium Training in Bangalore marathahalli
java training in chennai | java training in chennai Velachery |java training in chennai anna nagar
I love the blog. Great post. It is very true, people must learn how to learn before they can learn. lol i know it sounds funny but its very true. . .
ReplyDeleteData Science Training in Chennai
Data Science training in kalyan nagar
Data science training in Bangalore
Data Science training in marathahalli
Data Science interview questions and answers
Data science training in jaya nagar
This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
ReplyDeleteBest Devops online Training
Online DevOps Certification Course - Gangboard
Best Devops Training institute in Chennai
Inspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you..Keep update more information..
ReplyDeletepython Online training in chennai
python training institute in marathahalli
python training institute in btm
Python training course in Chennai
This is most informative and also this post most user friendly and super navigation to all posts... Thank you so much for giving this information to me..
ReplyDeleteAWS training in chennai
AWS Training in Bangalore
Useful information Thanks
ReplyDeleteI need native query information and related exceptions,if you known that please provide
ReplyDeleteI am happy for sharing on this blog its awesome blog I really impressed. thanks for sharing. Great efforts.
ReplyDeleteStart your journey with Best SAP Course and get hands-on Experience with 100% Placement assistance from experts Trainers @Softgen Infotech Located in BTM Layout Bangalore. Expert Trainers with 8+ Years of experience, Free Demo Classes Conducted.
Well explained . visit good hibernate tutorials
ReplyDeleteNice Post! Thank you for sharing very good post, it was so Nice to read and useful to improve my knowledge as updated one, keep blogging.
ReplyDeleteAWS training in chennai | AWS training in annanagar | AWS training in omr | AWS training in porur | AWS training in tambaram | AWS training in velachery
This comment has been removed by a blog administrator.
ReplyDelete