tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mauro2java2011 <>
Subject EntityManager into controller viewscoped
Date Sun, 12 Feb 2017 13:38:52 GMT
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; 


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 .


View this message in context:
Sent from the TomEE Users mailing list archive at

View raw message