It has been some hours I\'m working on this but still I haven\'t figured out what is the right way of using JPA with JSF.
I have a session scoped managed bean that can d
"someone tells that I have to inject the EM directly into my managed beans using the PersistenceContext annotation."
If you look at the Java EE tutorial, that's exactly what they do
@Singleton
public class MyUserDatabaseEntityManager {
// declare a producer field
@Produces
@UserDatabase
@PersistenceContext
private EntityManager em;
}
@ConversationScoped
@Stateful
public class RequestBean {
@Inject
@UserDatabase
EntityManager em;
This may not completely answer your question, but hope it helps.