9

According to hibernate 4 doc, the discriminator approach for multi-tenancy data was planned to be implemented on hibernate 5. However hibernate 5 doc is not up to date, it is still telling the same - 'Its support is planned for 5.0'.

So is it implemented or not? Any source telling more about it?

Vlad Mihalcea
  • 142,745
  • 71
  • 566
  • 911
Rafael Rocha
  • 756
  • 9
  • 15

3 Answers3

6

The HHH-6054 issue is still open, so Hibernate doesn't support this feature yet.

Vlad Mihalcea
  • 142,745
  • 71
  • 566
  • 911
1

Here are the docs referring to this. It is now available in Hibernate 6.

https://docs.jboss.org/hibernate/orm/6.0/userguide/html_single/Hibernate_User_Guide.html#multitenacy-hibernate-TenantId

Here is an example with Spring Boot

https://spring.io/blog/2022/07/31/how-to-integrate-hibernates-multitenant-feature-with-spring-data-jpa-in-a-spring-boot-application

Navid Mitchell
  • 1,276
  • 11
  • 10
  • A better link to docs (to @TenantId specifically): https://docs.jboss.org/hibernate/orm/6.0/userguide/html_single/Hibernate_User_Guide.html#multitenacy-hibernate-TenantId – lqc Dec 07 '22 at 12:48
-1

The HHH-6054 issue is now resolved. The docs also don't mention that DISCRIMINATOR cannot be used.

  • The issue is resolved as "Out of date" and not fixed. There are reasons to not remove an enum member even if it's not used. – lqc Dec 07 '22 at 12:42