title: What's the fastest way to check if a row exists in DB using Hibernate & spring?
body: <p>I need to check if a row exists in a database in a very fast way. 
  Let's say I've got the primary key.
  I found this code snippet in Hibernate's FAQ website:</p>
  
  <pre><code>Integer count = (Integer) session.createQuery("select count(*) from ....").uniqueResult();
  </code></pre>
  
  <p>I just started using spring, so I have HibernateTemplate object injected into my class.
  How do I translate this snippet to work with HibernateTemplate.</p>
  
  <p>Does anyone knows a better/faster way than this ?</p>
  
  <p>Thanks.</p>