Java Code Examples for org.springframework.orm.hibernate4.HibernateTransactionManager#setSessionFactory()

The following examples show how to use org.springframework.orm.hibernate4.HibernateTransactionManager#setSessionFactory() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) {
    HibernateTransactionManager txManager =  new HibernateTransactionManager();
    txManager.setSessionFactory(sessionFactory);
    return txManager;
}
 
Example 2
@Bean(name = "org.sakaiproject.sitestats.SiteStatsTransactionManager")
public PlatformTransactionManager getSiteStatsTransactionManager() throws IOException {
    if (siteStatsTransactionManager == null) {
        String whichDb = serverConfigurationService.getString("sitestats.db", "internal");
        if ("external".equals(whichDb)) {
            HibernateTransactionManager tx = new HibernateTransactionManager();
            tx.setSessionFactory(getSiteStatsSessionFactory());
            siteStatsTransactionManager = tx;
        } else {
            siteStatsTransactionManager = globalTransactionManager;
        }
    }
    return siteStatsTransactionManager;
}
 
Example 3
Source Project: tutorials   File: Cause3PersistenceConfig.java    License: MIT License 5 votes vote down vote up
@Bean
public HibernateTransactionManager transactionManager() {
    final HibernateTransactionManager txManager = new HibernateTransactionManager();
    txManager.setSessionFactory(sessionFactory().getObject());

    return txManager;
}
 
Example 4
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) {
    HibernateTransactionManager txManager =  new HibernateTransactionManager();
    txManager.setSessionFactory(sessionFactory);
    return txManager;
}
 
Example 5
@Bean(name = "org.sakaiproject.sitestats.SiteStatsTransactionManager")
public PlatformTransactionManager getSiteStatsTransactionManager() throws IOException {
    if (siteStatsTransactionManager == null) {
        String whichDb = serverConfigurationService.getString("sitestats.db", "internal");
        if ("external".equals(whichDb)) {
            HibernateTransactionManager tx = new HibernateTransactionManager();
            tx.setSessionFactory(getSiteStatsSessionFactory());
            siteStatsTransactionManager = tx;
        } else {
            siteStatsTransactionManager = globalTransactionManager;
        }
    }
    return siteStatsTransactionManager;
}
 
Example 6
@Bean(name = "org.sakaiproject.springframework.orm.hibernate.GlobalTransactionManager")
public PlatformTransactionManager transactionManager() throws IOException {
    if (platformTransactionManager == null) {
        if (sessionFactory == null) {
            sessionFactory();
        }
        HibernateTransactionManager txManager = new HibernateTransactionManager();
        txManager.setSessionFactory(sessionFactory);
        platformTransactionManager = txManager;
    }
    return platformTransactionManager;
}
 
Example 7
Source Project: blog   File: GreetingServiceConfig.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
public HibernateTransactionManager transactionManager(
		SessionFactory sessionFactory) {
	HibernateTransactionManager htm = new HibernateTransactionManager();
	htm.setSessionFactory(sessionFactory);
	return htm;
}
 
Example 8
Source Project: blog   File: GreetingServiceConfig.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
public HibernateTransactionManager transactionManager(
		SessionFactory sessionFactory) {
	HibernateTransactionManager htm = new HibernateTransactionManager();
	htm.setSessionFactory(sessionFactory);
	return htm;
}
 
Example 9
Source Project: tutorials   File: PersistenceConfig.java    License: MIT License 5 votes vote down vote up
@Bean
public HibernateTransactionManager transactionManager() {
    final HibernateTransactionManager txManager = new HibernateTransactionManager();
    txManager.setSessionFactory(sessionFactory().getObject());

    return txManager;
}
 
Example 10
Source Project: tutorials   File: Cause5NonTransientConfig.java    License: MIT License 5 votes vote down vote up
@Bean
public HibernateTransactionManager transactionManager() {
    final HibernateTransactionManager txManager = new HibernateTransactionManager();
    txManager.setSessionFactory(sessionFactory().getObject());

    return txManager;
}
 
Example 11
Source Project: tutorials   File: Cause4NonTransientConfig.java    License: MIT License 5 votes vote down vote up
@Bean
public HibernateTransactionManager transactionManager() {
    final HibernateTransactionManager txManager = new HibernateTransactionManager();
    txManager.setSessionFactory(sessionFactory().getObject());

    return txManager;
}
 
Example 12
Source Project: tutorials   File: Cause1NonTransientConfig.java    License: MIT License 5 votes vote down vote up
@Bean
public HibernateTransactionManager transactionManager() {
    final HibernateTransactionManager txManager = new HibernateTransactionManager();
    txManager.setSessionFactory(sessionFactory().getObject());

    return txManager;
}
 
Example 13
Source Project: tutorials   File: Cause1PersistenceConfig.java    License: MIT License 5 votes vote down vote up
@Bean
public HibernateTransactionManager transactionManager() {
    final HibernateTransactionManager txManager = new HibernateTransactionManager();
    txManager.setSessionFactory(sessionFactory().getObject());

    return txManager;
}
 
Example 14
Source Project: tutorials   File: Cause2PersistenceConfig.java    License: MIT License 5 votes vote down vote up
@Bean
public HibernateTransactionManager transactionManager() {
    final HibernateTransactionManager txManager = new HibernateTransactionManager();
    txManager.setSessionFactory(sessionFactory().getObject());

    return txManager;
}
 
Example 15
Source Project: quickperf   File: SpringConfig.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
public PlatformTransactionManager hibernateTransactionManager(LocalSessionFactoryBean sessionFactory) {
    HibernateTransactionManager transactionManager = new HibernateTransactionManager();
    transactionManager.setSessionFactory(sessionFactory.getObject());
    return transactionManager;
}
 
Example 16
Source Project: Project   File: RepositoryTestConfig.java    License: Apache License 2.0 4 votes vote down vote up
public PlatformTransactionManager annotationDrivenTransactionManager() {
  System.out.println(sessionFactory);
  HibernateTransactionManager transactionManager = new HibernateTransactionManager();
  transactionManager.setSessionFactory(sessionFactory);
  return transactionManager;
}
 
Example 17
Source Project: tutorials   File: PersistenceTestConfig.java    License: MIT License 4 votes vote down vote up
@Bean
public PlatformTransactionManager hibernateTransactionManager() {
    final HibernateTransactionManager transactionManager = new HibernateTransactionManager();
    transactionManager.setSessionFactory(sessionFactory().getObject());
    return transactionManager;
}
 
Example 18
@Bean(name = "org.sakaiproject.springframework.orm.hibernate.GlobalTransactionManager")
public PlatformTransactionManager transactionManager(SessionFactory sessionFactory) {
    HibernateTransactionManager txManager = new HibernateTransactionManager();
    txManager.setSessionFactory(sessionFactory);
    return txManager;
}
 
Example 19
Source Project: tutorials   File: PersistenceConfig.java    License: MIT License 4 votes vote down vote up
@Bean
public PlatformTransactionManager hibernateTransactionManager() {
    final HibernateTransactionManager transactionManager = new HibernateTransactionManager();
    transactionManager.setSessionFactory(sessionFactory().getObject());
    return transactionManager;
}
 
Example 20
@Bean(name = "org.sakaiproject.springframework.orm.hibernate.GlobalTransactionManager")
public PlatformTransactionManager transactionManager(SessionFactory sessionFactory) {
    HibernateTransactionManager txManager = new HibernateTransactionManager();
    txManager.setSessionFactory(sessionFactory);
    return txManager;
}