Hello,
Maybe it's not Spring specific question, but as it gains a lot of attention and a lot of guru around it, so my question could be answered here without confusion.
I'm using Spring and Hibernate in my DAO layer, below is my a DAO code snippets.
@Service("SomeDao")
@Repository
public class SomeDaoImpl implements SomeDao {
@PersistenceContext
private EntityManager em;
public Collection loadSomething(String query) {
Query query = em.createQuery(...);
return query.getResultList();
}
}
Per http://static.springsource.org/sprin...m-jpa-straight, the EntityManager is bound to a transaction, and thus it's thread safe, but in my application the 'loadSomething' can be called by multiple threads, though it's read-only, I'm not sure if it's thead safe or not having any other issues?
Thanks for your advice.


Reply With Quote