本文整理汇总了Java中org.springframework.orm.hibernate5.HibernateTransactionManager类的典型用法代码示例。如果您正苦于以下问题:Java HibernateTransactionManager类的具体用法?Java HibernateTransactionManager怎么用?Java HibernateTransactionManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HibernateTransactionManager类属于org.springframework.orm.hibernate5包,在下文中一共展示了HibernateTransactionManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.springframework.orm.hibernate5.HibernateTransactionManager; //导入依赖的package包/类
/**
*/
@Before
public void setUp() {
final DataSource ds = new DriverManagerDataSource(System.getProperty("jdbc.url", "jdbc:sap://localhost:30115"),
System.getProperty("jdbc.user", "hibernate"), System.getProperty("jdbc.password", "hibernate"));
final LocalSessionFactoryBuilder builder = new LocalSessionFactoryBuilder(ds);
builder.setProperty(AvailableSettings.DIALECT,
System.getProperty("hibernate.dialect", HANAColumnStoreDialect.class.getName()));
builder.setProperty(AvailableSettings.HBM2DDL_AUTO, "create-drop");
builder.setProperty(AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "true");
builder.addAnnotatedClass(Employee.class);
this.sessionFactory = builder.buildSessionFactory();
final HibernateTemplate ht = new HibernateTemplate();
ht.setSessionFactory(this.sessionFactory);
ht.afterPropertiesSet();
this.template = ht;
final HibernateTransactionManager txnMgr = new HibernateTransactionManager();
txnMgr.setDataSource(ds);
txnMgr.setSessionFactory(this.sessionFactory);
txnMgr.afterPropertiesSet();
this.transactionTemplate = new TransactionTemplate(txnMgr);
}
示例2: db1TransactionManager
import org.springframework.orm.hibernate5.HibernateTransactionManager; //导入依赖的package包/类
@Bean
public HibernateTransactionManager db1TransactionManager(DataSource dataSource,LocalSessionFactoryBean localSessionFactory) {
HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(localSessionFactory.getObject());
txManager.setDataSource(dataSource);
return txManager;
}
示例3: transactionManager
import org.springframework.orm.hibernate5.HibernateTransactionManager; //导入依赖的package包/类
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) {
System.out.println(sessionFactory);
HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(sessionFactory);
return txManager;
}
示例4: getTransactionManager
import org.springframework.orm.hibernate5.HibernateTransactionManager; //导入依赖的package包/类
@Bean(name = "transactionManager")
public HibernateTransactionManager getTransactionManager(
SessionFactory sessionFactory) {
HibernateTransactionManager transactionManager = new HibernateTransactionManager(
sessionFactory);
return transactionManager;
}
示例5: transactionManager
import org.springframework.orm.hibernate5.HibernateTransactionManager; //导入依赖的package包/类
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) {
HibernateTransactionManager hibernateTransactionManager = new HibernateTransactionManager();
hibernateTransactionManager.setSessionFactory(sessionFactory);
return hibernateTransactionManager;
}
示例6: txManager
import org.springframework.orm.hibernate5.HibernateTransactionManager; //导入依赖的package包/类
@Bean
public PlatformTransactionManager txManager() throws Exception {
HibernateTransactionManager returnVal = new HibernateTransactionManager(
hibernateConfig.sessionFactory());
returnVal.setDataSource(dataSourceConfig.dataSource());
return returnVal;
}
示例7: transactionManager
import org.springframework.orm.hibernate5.HibernateTransactionManager; //导入依赖的package包/类
/**
* Initialize Transaction Manager
* @param sessionFactory
* @return HibernateTransactionManager
*/
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) {
HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(sessionFactory);
return txManager;
}
示例8: transactionManager
import org.springframework.orm.hibernate5.HibernateTransactionManager; //导入依赖的package包/类
/**
* Initialize Transaction Manager
*
* @param sessionFactory
* @return HibernateTransactionManager
*/
@Bean
public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) {
HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(sessionFactory);
return txManager;
}
示例9: transactionManager
import org.springframework.orm.hibernate5.HibernateTransactionManager; //导入依赖的package包/类
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) {
HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(sessionFactory);
return txManager;
}
示例10: transactionManager
import org.springframework.orm.hibernate5.HibernateTransactionManager; //导入依赖的package包/类
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory s) {
final HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(s);
txManager.setDataSource(dataSource());
return txManager;
}
示例11: transactionManager
import org.springframework.orm.hibernate5.HibernateTransactionManager; //导入依赖的package包/类
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) {
HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(sessionFactory);
return txManager;
}
示例12: transactionManager
import org.springframework.orm.hibernate5.HibernateTransactionManager; //导入依赖的package包/类
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory s) {
HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(s);
return txManager;
}
示例13: txManager
import org.springframework.orm.hibernate5.HibernateTransactionManager; //导入依赖的package包/类
@Bean
public HibernateTransactionManager txManager() throws SQLException {
HibernateTransactionManager hibernateTransactionManager = new HibernateTransactionManager();
hibernateTransactionManager.setSessionFactory(sessionFactory().getObject());
return hibernateTransactionManager;
}
示例14: transactionManager
import org.springframework.orm.hibernate5.HibernateTransactionManager; //导入依赖的package包/类
@Bean
public PlatformTransactionManager transactionManager(SessionFactory sessionFatory) {
final HibernateTransactionManager txm = new HibernateTransactionManager();
txm.setSessionFactory(sessionFatory);
return txm;
}
示例15: buildTransactionManager
import org.springframework.orm.hibernate5.HibernateTransactionManager; //导入依赖的package包/类
private HibernateTransactionManager buildTransactionManager(String name, Config config, DataSource dataSource, JdbcConfig jdbc) {
return HibernateSessionBuilder.builder().packages(config.getDataSources().getOrElse(name, Arrays.asList())).dataSource(dataSource).env(jdbc).build()
.transactionManager();
}