Jadira does not support in multitenant environment ?
sreekanthsnair opened this issue · 15 comments
Jadira does not support in multitenant environment ?
Getting the below exception, while run application in multi tenant environment (using Hibernate multitenancy support)
Caused by: java.lang.NullPointerException
at org.jadira.usertype.spi.shared.AbstractUserTypeHibernateIntegrator.use42Api(AbstractUserTypeHibernateIntegrator.java:85)
at org.jadira.usertype.spi.shared.AbstractUserTypeHibernateIntegrator.integrate(AbstractUserTypeHibernateIntegrator.java:63)
at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:312)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1859)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:425)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849)
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318)
at org.egov.infra.config.persistence.JpaConfiguration.entityManagerFactory(JpaConfiguration.java:106)
What version are you using. How to reproduce?
Latest version 4.0.0.GA, can reproduce this by creating a hibernate multi tenant environment. Sorry, I don't have any test application to reproduce the issue. But if required i can help you with settings.
Yes please do share what you can. If you can demonstrate with a test it is a big benefit.
Sure, will try to create a sample project to recreate the issue, will let you know once its ready.
http://stackoverflow.com/questions/27197161/how-do-i-fetch-a-jdbc-connection-in-a-hibernate-4-3-integrator,
The API used to get connection by jadira is deprecated by hibernate, i guess the same deprecation reason would be the root cause for this issue too, i'm using hibernate latest version 5.x
Candidate fix being applied
Hi Crisphe, Is it released? shall i obtain from mavencentral to test it ?
No, its not released yet.
When will this be released?
Bump
When will it be released?
bump
This week
👍
Just wondering whether you can make a branch for the 4th version just to have it fixed for Hibernate 4 as well? I'd like to contribute with a pull request if there is a branch for previous version. Otherwise the change is pretty simple - lines 84&85 in AbstractUserTypeHibernateIntegrator should be replaced with:
final MultiTenancyStrategy multiTenancyStrategy = MultiTenancyStrategy.determineMultiTenancyStrategy(configuration.getProperties());
if (MultiTenancyStrategy.NONE == multiTenancyStrategy) {
conn = sessionFactory.getServiceRegistry().getService(ConnectionProvider.class).getConnection();
} else {
conn = sessionFactory.getServiceRegistry().getService(MultiTenantConnectionProvider.class).getAnyConnection();
}