Multitenancy at runtime only for some entities

Hi, I’m trying to connect a new java application to a legacy sql server project and I wanted to use the multitenancy feature of hibernate to achieve what I need.

Thing is, it’s not all databases that are duplicated for each tenant, it’s only a few.

For example, I have the databases :

  • AppSecDB_Tenant1
  • AppSecDB_Tenant2
  • CommonData
  • DataImport_Tenant1
  • DataImport_Tenant2
  • Identity
  • GlobalSecurity.

I’ve successfully setup hibernate so that the catalog of an entity is the database to use but I don’t see how I could setup multitenancy for only a few entities.

If I understand correctly the hibernate documentation, if I create a MultiTenantConnectionProvider and a CurrentTenantIdentifierResolver, I’ll be able to change the catalog but for all entities right?

Is there a way to achieve what I want?
Thank you in advance.