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

The following examples show how to use org.springframework.orm.hibernate4.HibernateTransactionManager#setSessionFactory() . 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
Source File: SiteStatsPersistenceConfig.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@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 2
Source File: Cause2PersistenceConfig.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
public HibernateTransactionManager transactionManager() {
    final HibernateTransactionManager txManager = new HibernateTransactionManager();
    txManager.setSessionFactory(sessionFactory().getObject());

    return txManager;
}
 
Example 3
Source File: Cause1PersistenceConfig.java    From tutorials with 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
Source File: Cause1NonTransientConfig.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
public HibernateTransactionManager transactionManager() {
    final HibernateTransactionManager txManager = new HibernateTransactionManager();
    txManager.setSessionFactory(sessionFactory().getObject());

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

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

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

    return txManager;
}
 
Example 8
Source File: GreetingServiceConfig.java    From blog with 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 File: GreetingServiceConfig.java    From blog with 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 10
Source File: SiteStatsTestConfiguration.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@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 11
Source File: ContextMappingConfiguration.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) {
    HibernateTransactionManager txManager =  new HibernateTransactionManager();
    txManager.setSessionFactory(sessionFactory);
    return txManager;
}
 
Example 12
Source File: Cause3PersistenceConfig.java    From tutorials with 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 File: SiteStatsPersistenceConfig.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@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 14
Source File: ContextMappingConfiguration.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) {
    HibernateTransactionManager txManager =  new HibernateTransactionManager();
    txManager.setSessionFactory(sessionFactory);
    return txManager;
}
 
Example 15
Source File: SpringConfig.java    From quickperf with 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 File: MessageBundleTestConfiguration.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
@Bean(name = "org.sakaiproject.springframework.orm.hibernate.GlobalTransactionManager")
public PlatformTransactionManager transactionManager(SessionFactory sessionFactory) {
    HibernateTransactionManager txManager = new HibernateTransactionManager();
    txManager.setSessionFactory(sessionFactory);
    return txManager;
}
 
Example 17
Source File: PersistenceConfig.java    From tutorials with 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
Source File: MessageBundleTestConfiguration.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
@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 File: PersistenceTestConfig.java    From tutorials with 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
Source File: RepositoryTestConfig.java    From Project with 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;
}