openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chintan4181 <chintan4...@gmail.com>
Subject Re: Multiple concurrent threads attempted to access a single broker
Date Fri, 23 Sep 2011 15:21:34 GMT
Seems that it is working. But now we are getting below exception: System
exception caught while executing save on Entity  com.foo.abc.domain.AbcDO
Can only perform operation while a transaction is active.: Can only perform
operation while a transaction is active.Exception Id:
fwrk_jpa_SAVE_FAILEDCategory: JPAData: null

We have created abstraction layer over JPA. As suggested in previous post,
we have created Map of EntityManagerFactor and retrieving entity manager
from it. Howerver when we persist object, we are getting above exception
Here is code for save(persist) method:

EntityManager em = null;
		try {
                                       //retrievies em from emf map
			em = getEntityManager(fnDO,serviceContext);  
			em.persist(fnDO); 
			em.flush();
		} catch (Exception sysEx) {
			FwrkPersistenceSystemException systemEx = new
FwrkPersistenceSystemException(
					FWRK_JPA_SAVE_FAILED, EXCEPTION_CATEGORY,
					SAVE_FAILED_MESSAGE + " " + fnDO.getClass().getName()+ " " +
sysEx.getMessage(), null);
			systemEx.setExceptionCause(sysEx);
			systemEx.setStackTrace(sysEx.getStackTrace());
			throw systemEx;
		}finally{
			if(null != em){
				em.close();
			}
		}

Finally we are closing em. is it because some other transaction has closed
em?

can you please help us to understand more?

Thanks
Chintan


--
View this message in context: http://openjpa.208410.n2.nabble.com/Multiple-concurrent-threads-attempted-to-access-a-single-broker-tp6820896p6824609.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message