title: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
body: <p>I have problem with:</p>
  
  <blockquote>
    <p>No Hibernate Session bound to thread, and configuration does not allow
    creation of non-transactional one here</p>
  </blockquote>
  
  <p>when testing my project.</p>
  
  <p>I use Spring 2.0.7(this is must in that project) and Hibernate 3. I have</p>
  
  <ul>
  <li><p>SessionFactory defined</p></li>
  <li><p>Transaction manager defined(with session factory injected)</p></li>
  <li><p><code>&lt;tx:annotation-driven transaction-manager="transactionManager"/&gt;</code> - 
  annotations for transactions switched on</p></li>
  </ul>
  
  <p>I have annotated my tests with:</p>
  
  <p>@Test</p>
  
  <p>@Transactional</p>
  
  <p>and inherited AbstractAnnotationAwareTransactionalTests</p>
  
  <p>=> I got this error:No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here</p>
  
  <p>Only way I can overcome it is to use: <code>TransactionStatus transaction = transactionManager.getTransaction(transactionDefinition);</code></p>
  
  <p>in test before I call</p>
  
  <pre><code>sessionFactory.getCurrentSession().save(myObject);
  </code></pre>
  
  <p>Any suggestions? Or better: how it works? Why it can not create transactional session ? Why no hibernate session is bound ? I have read something about it but it is still not clear to me. I think that I did everything to make it working but obviously it was not sufficient.</p>
  
  <p>Thx in advance,</p>
  
  <p>Stepik</p>