Skip to content

Commit

Permalink
refactor(persistence): simplify persistence service hierarchy (#2731)
Browse files Browse the repository at this point in the history
by merging classes:
* TenantHibernatePersistenceService
* AbstractHibernatePersistenceService
* AbstractDBPersistenceService

and by removing extra useless interface TenantPersistenceService

Also removed unused Datasource object
  • Loading branch information
educhastenier authored Oct 3, 2023
1 parent e7fc47c commit 7c18410
Show file tree
Hide file tree
Showing 6 changed files with 218 additions and 379 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.lang.reflect.Field;
import java.util.List;

import org.bonitasoft.engine.persistence.AbstractHibernatePersistenceService;
import org.bonitasoft.engine.persistence.HibernatePersistenceService;
import org.bonitasoft.engine.persistence.ReadPersistenceService;
import org.bonitasoft.engine.service.ServiceAccessorSingleton;
import org.hibernate.SessionFactory;
Expand Down Expand Up @@ -45,7 +45,7 @@ private static SessionFactory getSessionFactory() throws NoSuchFieldException, I

private static SessionFactory createSessionFactory() throws NoSuchFieldException, IllegalAccessException {
ReadPersistenceService persistenceService = ServiceAccessorSingleton.getInstance().getReadPersistenceService();
Field sessionFactoryField = AbstractHibernatePersistenceService.class.getDeclaredField("sessionFactory");
Field sessionFactoryField = HibernatePersistenceService.class.getDeclaredField("sessionFactory");
sessionFactoryField.setAccessible(true);
return (SessionFactory) sessionFactoryField.get(persistenceService);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1023,11 +1023,10 @@
</property>
</bean>

<bean id="persistenceService" class="org.bonitasoft.engine.persistence.TenantHibernatePersistenceService" destroy-method="destroy">
<bean id="persistenceService" class="org.bonitasoft.engine.persistence.HibernatePersistenceService" destroy-method="destroy">
<constructor-arg name="hbmConfigurationProvider" ref="hbmConfigurationProvider" />
<constructor-arg name="extraHibernateProperties" ref="extraHibernateProperties" />
<constructor-arg name="sequenceManager" ref="sequenceManager" />
<constructor-arg name="datasource" ref="bonitaNonXaDataSource" />
<constructor-arg name="queryBuilderFactory" ref="queryBuilderFactory" />
</bean>

Expand Down

This file was deleted.

Loading

0 comments on commit 7c18410

Please sign in to comment.