tags:

views:

96

answers:

1

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?

+3  A: 

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

waxwing