Search in sources :

Example 21 with HibernateTransactionManager

use of org.springframework.orm.hibernate5.HibernateTransactionManager in project dhis2-core by dhis2.

the class HibernateConfig method hibernateTransactionManager.

@Bean
public HibernateTransactionManager hibernateTransactionManager(DataSource dataSource, SessionFactory sessionFactory) {
    HibernateTransactionManager transactionManager = new HibernateTransactionManager();
    transactionManager.setSessionFactory(sessionFactory);
    transactionManager.setDataSource(dataSource);
    return transactionManager;
}
Also used : HibernateTransactionManager(org.springframework.orm.hibernate5.HibernateTransactionManager) LocalSessionFactoryBean(org.springframework.orm.hibernate5.LocalSessionFactoryBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

Bean (org.springframework.context.annotation.Bean)19 HibernateTransactionManager (org.springframework.orm.hibernate4.HibernateTransactionManager)11 LocalSessionFactoryBean (org.springframework.orm.hibernate4.LocalSessionFactoryBean)10 HibernateTransactionManager (org.springframework.orm.hibernate5.HibernateTransactionManager)6 LocalSessionFactoryBean (org.springframework.orm.hibernate5.LocalSessionFactoryBean)5 HibernateTransactionManager (org.springframework.orm.hibernate3.HibernateTransactionManager)4 Autowired (org.springframework.beans.factory.annotation.Autowired)3 LocalSessionFactoryBean (org.springframework.orm.hibernate3.LocalSessionFactoryBean)2 AnnotationSessionFactoryBean (org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean)2 DAOFactory (com.tomasio.projects.trainning.dao.DAOFactory)1 NetworkGroupDAO (com.tomasio.projects.trainning.dao.NetworkGroupDAO)1 NetworkGroupDTO (com.tomasio.projects.trainning.dto.NetworkGroupDTO)1 Session (org.hibernate.Session)1 SessionFactory (org.hibernate.SessionFactory)1 Transaction (org.hibernate.Transaction)1 SqlSessionFactoryBean (org.mybatis.spring.SqlSessionFactoryBean)1 JobExplorerFactoryBean (org.springframework.batch.core.explore.support.JobExplorerFactoryBean)1 JobRepositoryFactoryBean (org.springframework.batch.core.repository.support.JobRepositoryFactoryBean)1 FactoryBean (org.springframework.beans.factory.FactoryBean)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1