Uploaded image for project: 'Hibernate ORM'
  1. Hibernate ORM
  2. HHH-9766

Make CurrentSessionContext implementation isolate sessions per tenant id

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Last commented by a user?:
      true

      Description

      Today,
      CurrentSessionContext implementations cache sessions, per context (thread, managed, JTA). They also check that the session returned is using the right tenant id (according to CurrentTenantIdentifierResolver. An exception is raised other wise.

      A user proposed the following adjustments:

      CurrentSessionContext implementations will cache sessions per tenant id and per context. For a given context, say the same thread, we would receive different sessions if CurrentTenantIdentifierResolver returns different tenant ids between the calls to Session.currentSession().

      The use case is as followed. Some part of the application needs to access the data from more than one tenant (some admin or dashboard). In this case, it might be necessary to have different sessions for each tenant id requested within the same context.

      Steve Ebersole do you think that's a reasonable change?

      The context is here https://forum.hibernate.org/viewtopic.php?f=1&t=1035802

        Attachments

          Activity

            People

            • Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated: