Is there any benefit of using @NamedQuery over @NamedNativeQuery in hibernate or vice verse.
I cant spot the exact difference or
in which context we should use @NamedQuery over @NamedNativeQuery
Thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
@NamedNativeQuerylets you write a named SQL query, while@NamedQuerylets you write a named HQL query (or JPQL).In general, you should prefer to write HQL queries because then you can let Hibernate handle the intricacies of converting the HQL into the various SQL dialects. This will make your job much simpler when you choose to switch DBMS providers.