0

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?

1 Answer 1

3

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).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.