當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。