Hi all. 

I would use a requestscoped entitymanager into a viewaccesscoped controller. 

So i ask: 

The injected em requestscoped into controller viewscoped is a new em for
each request or  is all times the same into viewscoped  controller?

I know that the entity manager is not serializable. 

So if the em is  requestscoped i resolve the problem with tge serialization
of the em into viewaccesscoped cobtroller?

I have to configure some thing for use jta into cdi injected em ?

Into the class where i declare the method productor i have to use the 

@PersistenceContext (unitNane="namePU")
private EntityManager em; 

@Produces 
@RequestScoped

public EntityManager getEntityManager (){
return this.em;

}

Or i have to use the EntityManagerFactory with 

@PersistenceUnit (name="namePu")

private EntityManagerFactory emf;

public getEntityManager (){
return emf.createEntityManager;

}

public void closeEm (@Disposes EntityManager em){

em.close ();

}

Tank you very much .

Mauro




--
View this message in context: 
http://tomee-openejb.979440.n4.nabble.com/EntityManager-into-controller-viewscoped-tp4681054.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Reply via email to