本文整理汇总了Java中org.springframework.orm.hibernate5.HibernateTransactionManager.setSessionFactory方法的典型用法代码示例。如果您正苦于以下问题:Java HibernateTransactionManager.setSessionFactory方法的具体用法?Java HibernateTransactionManager.setSessionFactory怎么用?Java HibernateTransactionManager.setSessionFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.orm.hibernate5.HibernateTransactionManager
的用法示例。
在下文中一共展示了HibernateTransactionManager.setSessionFactory方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: transactionManager
import org.springframework.orm.hibernate5.HibernateTransactionManager; //导入方法依赖的package包/类
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) {
HibernateTransactionManager hibernateTransactionManager = new HibernateTransactionManager();
hibernateTransactionManager.setSessionFactory(sessionFactory);
return hibernateTransactionManager;
}
示例5: 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;
}
示例6: 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;
}
示例7: transactionManager
import org.springframework.orm.hibernate5.HibernateTransactionManager; //导入方法依赖的package包/类
@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包/类
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory s) {
final HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(s);
txManager.setDataSource(dataSource());
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) {
HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(s);
return txManager;
}
示例11: txManager
import org.springframework.orm.hibernate5.HibernateTransactionManager; //导入方法依赖的package包/类
@Bean
public HibernateTransactionManager txManager() throws SQLException {
HibernateTransactionManager hibernateTransactionManager = new HibernateTransactionManager();
hibernateTransactionManager.setSessionFactory(sessionFactory().getObject());
return hibernateTransactionManager;
}
示例12: transactionManager
import org.springframework.orm.hibernate5.HibernateTransactionManager; //导入方法依赖的package包/类
@Bean
public PlatformTransactionManager transactionManager(SessionFactory sessionFatory) {
final HibernateTransactionManager txm = new HibernateTransactionManager();
txm.setSessionFactory(sessionFatory);
return txm;
}