Por 9.99€ al mes tendrás acceso completo a todos los cursos. Sin matrícula ni permanencia.
En general, necesitas un EntityManager en cada transacción, y un EntityManager no debe ser usado en dos transacciones al mismo tiempo.
public class EntityManagerSingleton{
private static EntityManagerFactory emf;
public static EntityManager getEntityManager() {
if (emf == null) {
emf = Persistence.createEntityManagerFactory("TEST_PERSISTENCE_JPA");
}
EntityManager em = emf.createEntityManager();
return em;
}
}