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


Java HibernateTransactionManager.setSessionFactory方法代码示例

本文整理汇总了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);
}
 
开发者ID:aclemons,项目名称:hibernate-hdb-demo,代码行数:32,代码来源:TestEmployee.java

示例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;
}
 
开发者ID:PacktPublishing,项目名称:Spring-5.0-Cookbook,代码行数:8,代码来源:HiberConfig.java

示例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;
}
 
开发者ID:ArturWisniewski,项目名称:ToDoApp-Spring,代码行数:9,代码来源:HibernateConfig.java

示例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;
}
 
开发者ID:Exercon,项目名称:AntiSocial-Platform,代码行数:8,代码来源:HibernateConfiguration.java

示例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;
}
 
开发者ID:mjfcolas,项目名称:infotaf,代码行数:13,代码来源:AppConfig.java

示例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;
}
 
开发者ID:bytestree,项目名称:spring4-hibernate5-example,代码行数:13,代码来源:HibernateConfig.java

示例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;
}
 
开发者ID:amoldavsky,项目名称:restful-api-cxf-spring-java,代码行数:8,代码来源:HibernateConfig.java

示例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;
}
 
开发者ID:music-for-all,项目名称:music-for-all-application,代码行数:9,代码来源:HibernateConfigDev.java

示例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;
}
 
开发者ID:kibertoad,项目名称:swampmachine,代码行数:9,代码来源:AbstractInMemoryDBHibernateConfiguration.java

示例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;
}
 
开发者ID:rasertux,项目名称:reservaja,代码行数:8,代码来源:HibernateConfiguration.java

示例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;
}
 
开发者ID:dragon-yuan,项目名称:Ins_fb_pictureSpider_WEB,代码行数:7,代码来源:DatabaseConfiguration.java

示例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;
}
 
开发者ID:optionfactory,项目名称:hibernate-json,代码行数:7,代码来源:JsonDriverTest.java


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