title: Spring + Hibernate with transactions in multithreading environment
body: <p>I have a simple application that fetches some data from ONE table on db (MySQL 5.1) via Hibernate and display the content. The main framework used is Spring 3.0. The query runs correctly in @Transactional(read-only) (+second cache level).
  The problems come out running some concurrent tests with 20/30 requests against the same page. Some page-requests return 500 instead of 200. I suppose that is due to @Transactional doesn't manage multi-thread access (pls correct me if I am wrong).</p>
  
  <p>In the controller I have something like this:</p>
  
  <pre><code>List&lt;String&gt; names = usersService.getUserNames(); // this executes query in @Transactional env
  doSomething(names);
  </code></pre>
  
  <p>the logs say that "doSomething" threws some NullPointerException as there are not data in the list passed.</p>
  
  <p>Is there a way to implement a multi-thread access manager with Spring+Hibernate that manages concurrent requests to db?</p>