I am using successfully seam-persistence in my application. However, one of my bean cannot use an injected entity-manager :
Caused by: javax.naming.NameNotFoundException: Lookup of java:comp/UserTransaction not allowed for Container managed Transaction beans
here is my code :
@TransactionAttribute public class CurrentFileStore { @Inject @Client EspaceClient currentWorkspace; @Inject EntityManager em; @Produces @SessionScoped public FileStore getCurrentFileStore() { TypedQuery<FileStore> query = em.createQuery("SELECT store FROM FileStore store WHERE store.name = ?1", FileStore.class); query.setParameter(1, currentWorkspace); FileStore store = query.getSingleResult(); return store; } }
Is this because of the producer method ? Like I said before, I also have a Service only annotated @TransactionAttribute, injecting the entity manager in the same way, but the service is working perfectly.
Can someone help or explain if I'm doing wrong ?
We know about this one, and I believe it's been fixed, or will be shortly. Watch the commit log for Seam Persistence.