Using Named Queries (located in your hibernate mapping xml file) is a nice way to separate your queries from your buisness logic. But what are the alternatives if your are using Hibernate Annotations for mapping?
Share
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.
Maybe you already know, but there is a @NamedQuery annotation. However, I can’t even convince myself that this has any benefits over hard-coding the query string in an appropriate DAO (provided you are using DAOs and not accessing the session directly – then there could be a case for the @NamedQuery annotation).