This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 355458 - Provide admin user access data from multiple tenants
Summary: Provide admin user access data from multiple tenants
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 enhancement with 18 votes (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-23 02:35 EDT by Morten CLA
Modified: 2022-06-09 10:03 EDT (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Morten CLA 2011-08-23 02:35:23 EDT
Build Identifier: 

Multi-tenant entities cannot be queried across tenants for example for doing administration or statistics. 

Possible solutions:
* There should be possible to set a query hint to allow the extra criteria not to be appended at runtime.

* Allow null as tenant-id to disable the functionality

Reproducible: Always

Steps to Reproduce:
1. Mark an entity with @Multitenant and @TenantDiscriminator
2. Create a few entities with different tenants
3. Attempt to query for all of them, for example a count to know the total number of entities to show statistics. Only the count for the current tenant-id is shown.
Comment 1 Morten CLA 2011-08-24 03:03:04 EDT
I other people with the same problems: http://old.nabble.com/Re%3A-Suggestions-for-approaches-to-security-and-queries--p32068946.html

Can you provide any hints on a work-around or where to start looking to create a patch? This issue is a real show-stopper for us, so I would be grateful for any help! Thanks
Comment 2 Guy Pelletier CLA 2011-08-24 08:15:15 EDT
The way to do this currently is to define a new persistence unit with all the same model classes minus the @Multitenant metadata.
Comment 3 Tom Ware CLA 2011-08-24 11:25:30 EDT
Converting to Enhancement.

The enhancement is to provide a means to query without the tenant criteria without duplicating the persistence unit.
Comment 5 Ketan Prajapati CLA 2014-03-24 08:27:09 EDT
I want to use my Multi-Tenant solution without removing/changing annotation or XMl configuration for all entities.

In short, even my entities are annotated with @Multi-Tenant and @TenantDiscriminator annotation, but at all even, I do not set PersistenceUnitProperties.MULTITENANT_PROPERTY_DEFAULT then It should just ignore to add TENANT_ID as an additional criteria instead of throwing below exception.

javax.persistence.PersistenceException: Exception [EclipseLink-6174] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.QueryException
Exception Description: No value was provided for the session property [eclipselink.tenant-id]. This exception is possible when using additional criteria or tenant discriminator columns without specifying the associated contextual property. These properties must be set through Entity Manager, Entity Manager Factory or persistence unit properties. If using native EclipseLink, these properties should be set directly on the session.


For more information, please refer

http://stackoverflow.com/questions/22562770/eclipselink-how-to-turn-off-multi-tenancy-even-if-i-annotate-entity-with-multi/22597988

Ketan Prajapati
Comment 6 Eclipse Webmaster CLA 2022-06-09 10:03:17 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink