Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Annotations and Named Queries

 
Thomas Bigbee
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings all

In most of the books I've read (on Hibernate) they specify that Named Queries should be placed at the bottom of the mapping file

From Hibernate Quickly...

Named queries, not to be confused with named parameters, are queries
that are embedded in the XML mapping definition. Typically, you put
all of the queries for a given object into the same file. Centralizing your
queries in this fashion makes maintenance quite a bit easier. Named
queries are placed at the bottom of the mapping definition files:


My question is this. When attending Advanced Hibernate Training in Atlanta last week, the instructor stated, that, Annotations should be used as opposed to Mapping files, with that said, Annotations allow you to place the Named Queries and the Package or Class Level, my questions is this: what is the difference between the two, and why would you pick one over the other?

Any feedback appreciated.
 
Christian Bauer
author
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Personal taste.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic