Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: MultiTenant with different Dialects
PostPosted: Fri Oct 27, 2017 9:57 am 
Newbie

Joined: Fri Oct 27, 2017 9:10 am
Posts: 2
Hi Community,

Would it be possible to use multi tenant with Hibernate, but for each tenant I could choose which dialect to use?

I'm working on a project migration where each tenant is allowed to set up a database connection for different vendors (SQLServer, Oracle, PostgreSQL)

To implement multi tenant, I used MultiTenantConnectionProvider and CurrentTenantIdentifierResolver but, I did not see possibilities to inform the dialect by tenant.

I've also tried to implement a DialectResolver, but it has no relation to Multi Tenant.

Is there anything else I can do?


Thanks


Top
 Profile  
 
 Post subject: Re: MultiTenant with different Dialects
PostPosted: Fri Oct 27, 2017 10:14 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1527
I don't think so. The Dialect is related to the SessionFactory, and, when using multi-tenancy, there's only one SessionFactory, even if you use multiple tenants.

So, the only way to fix it is to create one SessionFactory for each Dialect, and link all tenants associated to a particular Dialect to its associated SessionFactory.

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
 Post subject: Re: MultiTenant with different Dialects
PostPosted: Fri Oct 27, 2017 12:43 pm 
Newbie

Joined: Fri Oct 27, 2017 9:10 am
Posts: 2
Okay, I'll evaluate the alternative.

Thank you !


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.