Eclipselink Multitenancy problem [message #1700470] |
Thu, 02 July 2015 18:31 |
Sven Moschel Messages: 4 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.
|
|
|
Powered by
FUDForum. Page generated in 0.03959 seconds