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 do a lot of things, and one of them is persisting some entity objects. At the beginning, I created a producer method, request scoped, that build my EntityManager objects. Anyway a read here that injecting a requested scoped bean into a session scoped ones is done wrapping that instance into an Instance object. Done. But when I try to use that EM I got a transaction required exception. Keep on reading on the internet someone tells that I have to inject the EM directly into my managed beans using the PersistenceContext annotation. Anyway I thought it has more sense using a persistenceUnit annotation and creating my em inside my methods where I needed them. Injection works, but I still get a transaction required exception when I try to persist something!
So here I am asking: what is the right way of doing this?
edit: I'm using Jboss eap 6.2 using default settings. I'm deploying my data source using a xml file inside WEB-INF, so I'm using JTA.