本文整理汇总了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;
}
});
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
});
}
示例6: getTransactionManagerReturnsTheTransactionManager
import org.springframework.orm.hibernate3.HibernateTransactionManager; //导入依赖的package包/类
@Test
public void getTransactionManagerReturnsTheTransactionManager() {
// GIVEN
// WHEN
HibernateTransactionManager actualTransactionManager = unitDaoFactory.getTransactionManager();
// THEN
assertThat(actualTransactionManager).isSameAs(transactionManager);
}
示例7: setTxManager
import org.springframework.orm.hibernate3.HibernateTransactionManager; //导入依赖的package包/类
public void setTxManager(HibernateTransactionManager txManager){
this.txManager = txManager;
}
示例8: setTxnManager
import org.springframework.orm.hibernate3.HibernateTransactionManager; //导入依赖的package包/类
public void setTxnManager(HibernateTransactionManager txManager) {
this.txnManager = txManager;
}