Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Eclipselink Multitenancy problem(PeristenceContext or PersistenceUnit)
Eclipselink Multitenancy problem [message #1700470] Thu, 02 July 2015 18:31
Sven Moschel is currently offline Sven MoschelFriend
Messages: 2
Registered: July 2015
Junior Member
We have a web application that should support multi tenancy. As persistence framework we want to user Eclipselkink with its Multitenant feature.

Here are our requirements:
- The web application should be container managed (JTA)
- We want to use the single table approach. Each tenant entity becomes a tenant_id.
- Admins are able to create tenants on the fly. That means each user was assigned to its tenant. On login we read the tenantId and pass it to the EntityManager.

At the moment I have some transaction problems. I´ve injected the EntityManagerFactory with @PersistenceUnit annotation and pass the tenant id and the shared cache setting to the entity manager. Queries works fine but merge/persist of entities don´t work anymore. There is no exception. I think its a transaction problem.

In a further version i used the @PersistenceContext and everything is works fine. But i think injection the persistence context is don´t allowed in "Persistence Context per Tenant" (see https://wiki.eclipse.org/EclipseLink/Examples/JPA/Multitenant)

How could I use container managed transactions (persistence context) and tell the entity manager which tenant id it should use?

Thanks for your answers.
Previous Topic:Query Caching
Next Topic:CDI Entity Listeners - EclipseLink
Goto Forum:
  


Current Time: Fri Mar 05 08:29:28 GMT 2021

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

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

Back to the top