Hello Atlassian,
We are upgrading our confluence server from V5.8.13 to V6.6.2. We found that confluence has upgraded the hibernate version2 to version5 because of this we are facing some difficulties for accessing our custom tables.
In confluence V5.8.13 we used to add custom.hbm.xml mapping configurations to the existing confluence hibernate configuration by editing the hibernate session factory.
import com.atlassian.spring.container.ContainerManager;
import bucket.core.persistence.hibernate.ConfigurableLocalSessionFactoryBean;
import net.sf.hibernate.SessionFactory;
ConfigurableLocalSessionFactoryBean localSessionFactoryBean =(ConfigurableLocalSessionFactoryBean)ContainerManager.getInstance().getContainerContext().getComponent("&tenantedLocalSessionFactoryBean");
SessionFactory sf = (SessionFactory) localSessionFactoryBean.getObject();
Using reflection we were able to access all the fields and methods to modify the namedQueries and ClassPersisters and hibernate configurations dynamically.
Field classPersistersField = sessionFactory.getClass().getDeclaredField(“classPersisters”);
classPersistersField.setAccessible(true);
In confluence V6.6.2 the hibernate version is been upgraded to V5.
We are facing difficulties with the upgraded hibernate version, can you please help how to dynamically map our custom.hbm.xml configurations and access the custom tables using the hibernate session.
Thanks
Sushanth