9
votes

I want to implement DISCRIMINATOR based Multi-Tenancy solution for Shared Schema Based Multi-Tenancy Model-common database schema for all tenants.

Technology stack

  • Hibernate 3 Global filter (I can't use EclipseLink)
  • Spring Data JPA - I want this because we are already using this one and we cant change it.

My questions are

  • How to achieve this : Spring Data JPA has no any support for GLOBAL filter so I need to add customize Spring Data JPA repository which can in-turn apply global filter for DISCRIMINATOR based solution?
  • At all, Is it possible to implement my requirement with Spring Data JPA+Hibernate 3?
1
Must you use Hibernate 3? 5.x is current.sofend
What I can definitely tell you is, that Hibernate still have no support for discriminator based multi-tenancy. We had the same issue in our project and we're on hibernate 5.xAnsgar Schulte
Hibernate does not support discriminator multi-tenancy. It does support schema or connection based tenancy though: docs.jboss.org/hibernate/core/4.2/devguide/en-US/html/ch16.htmlJan-Willem Gmelig Meyling

1 Answers

2
votes

Using hibernate filters you can achieve below items in our application,

  1. Multi-tenancy,
  2. Authorisation
  3. Authentication
  4. Row level authorisation

In our application we applied this and got great results and applied the same stuff to other web based products as well. For your reference go through the below link and you will get some idea on the above stuffs. http://www.jroller.com/RickHigh/entry/using_spring_aop_and_hibernate