Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Transaction Support EclipseLink + JPA + MongoDB
Transaction Support EclipseLink + JPA + MongoDB [message #1406163] Sat, 09 August 2014 07:06
Manoj Hoskeri is currently offline Manoj HoskeriFriend
Messages: 1
Registered: August 2014
Junior Member
Hello All,

We have a Web Application wherein we have used EclipseLink + JPA + MongoDB as our Persistence Framework setup.

I am facing a problem with multiple requests for CRUD operations from the server. The Exception that I'm getting is as follows -
[Transaction is currently active] with root cause java.lang.IllegalStateException

The Entity Manager is initialized as follows :

Map<String, Object> properties = new HashMap<String, Object>();
        properties.put(PersistenceUnitProperties.CLASSLOADER, DAOServiceImpl.class.getClassLoader());
        entityManagerFactory = new PersistenceProvider().createEntityManagerFactory("mongo", properties);
        entityManager = entityManagerFactory.createEntityManager();

	public <T> T createEntity(final T entity) {
        return entity;

    public <T> T readEntity(final String entityId, final Class<T> entityClass) {
        return entityManager.find(entityClass, entityId);

    public <T> T updateEntity(final T entity) {
        T merged = entityManager.merge(entity);
        return merged;

    public <T> boolean deleteEntity(final String entityId, final Class<T> entityClass) {
        T entity = entityManager.find(entityClass, entityId);
        return true;

The persistence.xml file is as follows :

	<persistence-unit name="mongo" transaction-type="RESOURCE_LOCAL">

			<property name=""
				value="org.eclipse.persistence.nosql.adapters.mongo.MongoPlatform" />
			<property name="eclipselink.nosql.connection-spec"
				value="org.eclipse.persistence.nosql.adapters.mongo.MongoConnectionSpec" />
			<property name=""
				value="27017" />
			<property name=""
				value="localhost" />
			<property name="" value="esysdb" />
			<!-- property name="eclipselink.logging.level" value="FINEST" / -->



We are using only one EntityManager in our entire application.
Am I doing the setup in a correct way?

I understand that EclipseLink + MongoDB does not support transactions. But, could anybody please let me know if there are any workarounds for this ?

Can EclipseLink + JPA + MongoDB support multi-user scenario with proper handling of database transacations ?

How can I prevent the usage of EntityManager by multiple requests at once ?

Previous Topic:@ReadOnly & @Cacheable
Next Topic:_persistence_checkFetched
Goto Forum:

Current Time: Thu May 24 14:18:08 GMT 2018

Powered by FUDForum. Page generated in 0.02196 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top