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


Java HibernateTransactionManager类代码示例

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


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

示例1: dumpDatabaseToXml

import org.springframework.orm.hibernate3.HibernateTransactionManager; //导入依赖的package包/类
/**
 * Schreibt alle Objekte der Datenbank in den angegebenen Writer.<br/>
 * <b>Warnung!</b> Bei der Serialisierung von Collections wird derzeit nur {@link java.util.Set} sauber unterstützt.
 * @param writer Ziel für die XML-Datei.
 * @param includeHistory bei false werden die History Einträge nicht geschrieben
 * @param preserveIds If true, the object ids will be preserved, otherwise new ids will be assigned through xstream.
 */
public void dumpDatabaseToXml(final Writer writer, final boolean includeHistory, final boolean preserveIds)
{
  final TransactionTemplate tx = new TransactionTemplate(new HibernateTransactionManager(hibernate.getSessionFactory()));
  tx.execute(new TransactionCallback() {
    public Object doInTransaction(final TransactionStatus status)
    {
      hibernate.execute(new HibernateCallback() {
        public Object doInHibernate(final Session session) throws HibernateException
        {
          writeObjects(writer, includeHistory, session, preserveIds);
          status.setRollbackOnly();
          return null;
        }
      });
      return null;
    }
  });
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:26,代码来源:HibernateXmlConverter.java

示例2: springfieldSessionFactoryTx

import org.springframework.orm.hibernate3.HibernateTransactionManager; //导入依赖的package包/类
public HibernateTransactionManager springfieldSessionFactoryTx() throws Exception{
	logger.info("create HibernateTransactionManager");

	HibernateTransactionManager tx = new HibernateTransactionManager();
	tx.setSessionFactory(springfieldSessionFactory().getObject());
	return tx;
}
 
开发者ID:u2ware,项目名称:springfield,代码行数:8,代码来源:ContextRepositoryHibernate.java

示例3: transactionManager

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

    return txManager;
}
 
开发者ID:ganzux,项目名称:SIRME,代码行数:8,代码来源:AppTestConfig.java

示例4: transactionManager

import org.springframework.orm.hibernate3.HibernateTransactionManager; //导入依赖的package包/类
@Bean
public PlatformTransactionManager transactionManager()
{
    final HibernateTransactionManager xam = new HibernateTransactionManager();
    xam.setSessionFactory(sessionFactory());
    xam.afterPropertiesSet();
    return xam;
}
 
开发者ID:dalvizu,项目名称:wicket-spring-hibernate-template,代码行数:9,代码来源:WebConfig.java

示例5: reindex

import org.springframework.orm.hibernate3.HibernateTransactionManager; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked"})
private void reindex(final Class< ? > clazz, final ReindexSettings settings, final StringBuffer buf)
{
  // PF-378: Performance of run of full re-indexing the data-base is very slow for large data-bases
  // Single transactions needed, otherwise the full run will be very slow for large data-bases.
  final TransactionTemplate tx = new TransactionTemplate(new HibernateTransactionManager(hibernate.getSessionFactory()));
  tx.execute(new TransactionCallback() {
    // The call-back is needed, otherwise a lot of transactions are left open until last run is completed:
    public Object doInTransaction(final TransactionStatus status)
    {
      try {
        hibernate.execute(new HibernateCallback() {
          public Object doInHibernate(final Session session) throws HibernateException
          {
            databaseDao.reindex(clazz, settings, buf);
            status.setRollbackOnly();
            return null;
          }
        });
      } catch (final Exception ex) {
        buf.append(" (an error occured, see log file for further information.), ");
        log.error("While rebuilding data-base-search-index for '" + clazz.getName() + "': " + ex.getMessage(), ex);
      }
      return null;
    }
  });
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:28,代码来源:HibernateSearchReindexer.java

示例6: getTransactionManagerReturnsTheTransactionManager

import org.springframework.orm.hibernate3.HibernateTransactionManager; //导入依赖的package包/类
@Test
public void getTransactionManagerReturnsTheTransactionManager() {
	// GIVEN

	// WHEN
	HibernateTransactionManager actualTransactionManager = unitDaoFactory.getTransactionManager();

	// THEN
	assertThat(actualTransactionManager).isSameAs(transactionManager);
}
 
开发者ID:cpollet,项目名称:jixture,代码行数:11,代码来源:TestHibernate3UnitDaoFactory.java

示例7: setTxManager

import org.springframework.orm.hibernate3.HibernateTransactionManager; //导入依赖的package包/类
public void setTxManager(HibernateTransactionManager txManager){
    this.txManager = txManager;
}
 
开发者ID:xenit-eu,项目名称:move2alf,代码行数:4,代码来源:ConditionalDataSourceInitializer.java

示例8: setTxnManager

import org.springframework.orm.hibernate3.HibernateTransactionManager; //导入依赖的package包/类
public void setTxnManager(HibernateTransactionManager txManager) {
    this.txnManager = txManager;
}
 
开发者ID:mobilipia,项目名称:Deskera-HRMS,代码行数:4,代码来源:hrmsEmpController.java


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