当前位置: 首页>>代码示例>>Java>>正文


Java HibernateTransactionManager类代码示例

本文整理汇总了Java中org.springframework.orm.hibernate4.HibernateTransactionManager的典型用法代码示例。如果您正苦于以下问题:Java HibernateTransactionManager类的具体用法?Java HibernateTransactionManager怎么用?Java HibernateTransactionManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HibernateTransactionManager类属于org.springframework.orm.hibernate4包,在下文中一共展示了HibernateTransactionManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: transactionManager

import org.springframework.orm.hibernate4.HibernateTransactionManager; //导入依赖的package包/类
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory s) {
   HibernateTransactionManager txManager = new HibernateTransactionManager();
   txManager.setSessionFactory(s);
   return txManager;
}
 
开发者ID:mustafamym,项目名称:FeedbackCollectionAndMgmtSystem,代码行数:8,代码来源:HibernateConfiguration.java

示例2: getTransactionManager

import org.springframework.orm.hibernate4.HibernateTransactionManager; //导入依赖的package包/类
@Autowired
@Bean(name="transactionManager")
public HibernateTransactionManager getTransactionManager(SessionFactory sessionFactory)
{
	System.out.println("--Transaction manager Object Creation--");
	HibernateTransactionManager transactionManager=new HibernateTransactionManager(sessionFactory);
	System.out.println("--Transaction manager Object Created--");
	return transactionManager;
}
 
开发者ID:AakashOfficial,项目名称:Book-Management,代码行数:10,代码来源:DBConfig.java

示例3: transactionManager

import org.springframework.orm.hibernate4.HibernateTransactionManager; //导入依赖的package包/类
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory s) {
    HibernateTransactionManager txManager = new HibernateTransactionManager();
    txManager.setSessionFactory(s);
    return txManager;
}
 
开发者ID:zsavvas,项目名称:ReCRED_FIDO_UAF_OIDC,代码行数:8,代码来源:HibernateConfiguration.java

示例4: getTransactionManager

import org.springframework.orm.hibernate4.HibernateTransactionManager; //导入依赖的package包/类
@Autowired
@Bean(name = "transactionManager")
public HibernateTransactionManager getTransactionManager(SessionFactory sessionFactory)
{
	HibernateTransactionManager transactionManager = new HibernateTransactionManager(sessionFactory);

	return transactionManager;
}
 
开发者ID:OpenDataCyprus,项目名称:integers,代码行数:9,代码来源:ApplicationContextConfig.java

示例5: getTransactionManager

import org.springframework.orm.hibernate4.HibernateTransactionManager; //导入依赖的package包/类
@Autowired
@Bean(name = "transactionManager")
public HibernateTransactionManager getTransactionManager(SessionFactory sessionFactory) {
	HibernateTransactionManager transactionManager = new HibernateTransactionManager(sessionFactory);

	return transactionManager;
}
 
开发者ID:kodgemisi-archive,项目名称:camp,代码行数:8,代码来源:RootConfig.java

示例6: transactionManager

import org.springframework.orm.hibernate4.HibernateTransactionManager; //导入依赖的package包/类
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) {
	HibernateTransactionManager txManager = new HibernateTransactionManager();
	txManager.setSessionFactory(sessionFactory);
	return txManager;
}
 
开发者ID:karabill,项目名称:maellak_spring_example,代码行数:8,代码来源:MyConfiguration.java

示例7: transactionManager

import org.springframework.orm.hibernate4.HibernateTransactionManager; //导入依赖的package包/类
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) {
  HibernateTransactionManager txManager = new HibernateTransactionManager();
  txManager.setSessionFactory(sessionFactory);

  return txManager;
}
 
开发者ID:tloszabno,项目名称:FirefightersCenter,代码行数:9,代码来源:PersistenceCOnfig.java

示例8: getCurrentDatasource

import org.springframework.orm.hibernate4.HibernateTransactionManager; //导入依赖的package包/类
public DataSource getCurrentDatasource(){
	if(!masterSlave)
		return masterDatasource;
	
	SwitcherInfo switcher = contextHolder.getContextAttribute(SwitcherInfo.CURRENT_SWITCHER_INFO);
	DataSource ds = masterDatasource;
	if(switcher==null || StringUtils.isBlank(switcher.getCurrentSwitcherName())){
		return ds;
	}
	switch (switcher.getType()) {
	case TransactionManager:
		PlatformTransactionManager pt = (PlatformTransactionManager)Springs.getInstance().getBean(switcher.getCurrentSwitcherName());
		if(isHibernateTransactionManager(pt)){
			ds = ((HibernateTransactionManager)pt).getDataSource();
		}else if(DataSourceTransactionManager.class.isInstance(pt)){
			ds = ((DataSourceTransactionManager)pt).getDataSource();
		}else{
			throw new UnsupportedOperationException("TransactionManager: " + switcher.getCurrentSwitcherName());
		}
		break;

	default:
		String dsName = switcher.getCurrentSwitcherName();// + DATASOURCE_KEY;
		if(datasources.containsKey(dsName))
			ds = datasources.get(dsName);
		break;
	}
	return ds;
}
 
开发者ID:wayshall,项目名称:onetwo,代码行数:30,代码来源:DbmMultipleDatasource.java

示例9: transactionManager

import org.springframework.orm.hibernate4.HibernateTransactionManager; //导入依赖的package包/类
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) {
    HibernateTransactionManager txManager =  new HibernateTransactionManager();
    txManager.setSessionFactory(sessionFactory);
    return txManager;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:8,代码来源:ContextMappingConfiguration.java

示例10: transactionManager

import org.springframework.orm.hibernate4.HibernateTransactionManager; //导入依赖的package包/类
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) {
    HibernateTransactionManager txManager = new HibernateTransactionManager();
    txManager.setSessionFactory(sessionFactory);

    return txManager;
}
 
开发者ID:olegnikitin,项目名称:thesis,代码行数:9,代码来源:DBConfiguration.java

示例11: transactionManager

import org.springframework.orm.hibernate4.HibernateTransactionManager; //导入依赖的package包/类
@Bean
public HibernateTransactionManager transactionManager() {

	if (this.enabled) {
		return new HibernateTransactionManager(this.sessionFactory()
				.getObject());
	}
	return null;
}
 
开发者ID:fpuna-cia,项目名称:karaku,代码行数:10,代码来源:KarakuPersistence.java

示例12: executeSQL

import org.springframework.orm.hibernate4.HibernateTransactionManager; //导入依赖的package包/类
/**
 * @param testContext
 * @param file
 * @param slsce
 */
private void executeSQL(TestContext testContext, String file,
		SingleLineSqlCommandExtractor slsce) {

	BufferedReader br;
	ClassPathResource cpr = getClassPathResource(file, testContext);
	br = _getBr(cpr);
	// File f = new File(scriptPath);
	// FileReader fr = new FileReader(file);

	final String[] commands = slsce.extractCommands(br);
	if (commands == null) {
		return;
	}
	final HibernateTransactionManager tm = getTransactionManager(testContext);
	final TransactionTemplate tt = new TransactionTemplate(tm);
	tt.execute(new TransactionCallbackWithoutResult() {

		@Override
		protected void doInTransactionWithoutResult(TransactionStatus status) {

			for (String s : commands) {
				if (StringUtils.isInvalid(s)) {
					continue;
				}

				SQLQuery sql = tm.getSessionFactory().getCurrentSession()
						.createSQLQuery(s.trim());
				sql.executeUpdate();
			}

		}
	});

}
 
开发者ID:fpuna-cia,项目名称:karaku,代码行数:40,代码来源:DatabasePopulatorCucumberExecutionListener.java

示例13: buildHibernateTransactionManagerBeanDefinition

import org.springframework.orm.hibernate4.HibernateTransactionManager; //导入依赖的package包/类
private BeanDefinition buildHibernateTransactionManagerBeanDefinition(Element element, String name) {
	AbstractBeanDefinition beanDefinition = new GenericBeanDefinition();
	beanDefinition.setAttribute(ID_ATTRIBUTE, name + HIBERNATE_TRANSACTION_MANAGER_SUFFIX);
	beanDefinition.setBeanClass(HibernateTransactionManager.class);
	MutablePropertyValues propertyValues = new MutablePropertyValues();
	propertyValues.add("sessionFactory", new RuntimeBeanReference(name + SESSION_FACTORY_SUFFIX));
	beanDefinition.setPropertyValues(propertyValues);
	return beanDefinition;
}
 
开发者ID:xiaolongzuo,项目名称:zxl,代码行数:10,代码来源:MulCommonBaseServiceParser.java

示例14: buildSessionFactory

import org.springframework.orm.hibernate4.HibernateTransactionManager; //导入依赖的package包/类
@Override
public synchronized SessionFactory buildSessionFactory() {
	try {
		LOG.debug("Building new session factory");
		SessionFactory real = configurationProvider.getConfiguration().buildSessionFactory(
				this.serviceRegistryBuilder.buildServiceRegistry());

		LOG.debug("Session factory created, creating new Transaction Manager to handle transactions");
		HibernateTransactionManager txManager = new HibernateTransactionManager();

		txManager.setDataSource(((DatasourceConnectionProviderImpl) ((SessionFactoryImplementor) real).getServiceRegistry()
				.getService(ConnectionProvider.class)).getDataSource());
		txManager.setSessionFactory(proxySessionFactory);
		txManager.setValidateExistingTransaction(true);
		txManager.afterPropertiesSet();

		// The anotations at this point uses the new transaction manager
		AnnotationTransactionAspect txAspect = AnnotationTransactionAspect.aspectOf();
		txAspect.setTransactionManager(txManager);
		LOG.debug("New transaction manager established to AnnotationTransactionAspect, now the annotations used the new Transaction Manager");

		return real;
	} catch (RuntimeException ex) {
		LOG.error("Runtime exception when trying to create session factory.", ex);
		throw ex;
	}
}
 
开发者ID:frincon,项目名称:openeos,代码行数:28,代码来源:SessionFactoryManagerOsgiService.java

示例15: transactionManager

import org.springframework.orm.hibernate4.HibernateTransactionManager; //导入依赖的package包/类
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) {
   HibernateTransactionManager txManager = new HibernateTransactionManager();
   txManager.setSessionFactory(sessionFactory);
 
   return txManager;
}
 
开发者ID:jkardynia,项目名称:mvc-spring-hibernate,代码行数:9,代码来源:HibernateConfig.java


注:本文中的org.springframework.orm.hibernate4.HibernateTransactionManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。