title: Hibernate named queries vs session queries -- looking for opinion
body: <p>note: this Q is looking for a comparison of Hibernate named queries and ordinary session queries. Hibernate Criteria is of no concern within the context of this Q.</p>
  
  <p>from what i know, named queries are those parsed once when the system starts up, and can be used from everywhere throughout the application. so - w/named queries, the query isn't parsed from scratch for each caller of that query and this is the major gain in named queries. </p>
  
  <p>but then - </p>
  
  <ul>
  <li><p>is there a difference between how Hibernate operates its caches for named- and ordinary-queries? if so- what is this?  </p></li>
  <li><p>is there any loss in turning ordinary Hibernate queries into named-queries? </p></li>
  </ul>
  
  <p>i've had a discussion w/a colleague. he thinks that, before i should go turning ordinary queries into named queries, i should device some metrics and write tests just to prove how named-queries is performing better. </p>
  
  <p>i think this-- generating metrics and writing tests just for the sake of measuring how/whether named queries perform better than ordinary queries is nothing but burning time into something useless. that's been shown already-- the reason of existence of named queries is just getting the query parsed. what data it's pulling/changing in DB is immaterial. and, Hibernate named queries is being used by many developers. </p>
  
  <p>my Q is - </p>
  
  <ul>
  <li><p>am i missing something in named queries that is relevant to this discussion?</p></li>
  <li><p>opinions on how to handle this situation? the options i'm looking at are i.) drop doing anything at all-- let queries as is, ii.) just change named queries-- reverting if disliked wont have burned too much of my time  iii.) do those tests-- if i would consider this as an option. </p></li>
  </ul>
  
  <p>TIA.   </p>