EntityManager ThreadLocal pattern with JPA in JSE
问题 I'm developing a simple "Book Store" project using Struts 1.3 + JPA (with Hibernate as persistence provider). I cannot switch to Spring or any other more sophisticated development environment (e.g., Jboss) and I cannot use any Hibernate-specific technique (e.g., Session class). Given the fact that I'm in a JSE Environment, I need to explicitly manage the whole EntityManager's lifecycle. The Book entity is defined as follows: @Entity public class Book { @Id private String isbn; private String