本文整理汇总了Java中org.springframework.orm.hibernate5.LocalSessionFactoryBuilder类的典型用法代码示例。如果您正苦于以下问题:Java LocalSessionFactoryBuilder类的具体用法?Java LocalSessionFactoryBuilder怎么用?Java LocalSessionFactoryBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LocalSessionFactoryBuilder类属于org.springframework.orm.hibernate5包,在下文中一共展示了LocalSessionFactoryBuilder类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setUp
import org.springframework.orm.hibernate5.LocalSessionFactoryBuilder; //导入依赖的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: buildSessionFactory
import org.springframework.orm.hibernate5.LocalSessionFactoryBuilder; //导入依赖的package包/类
@Override
protected SessionFactory buildSessionFactory(LocalSessionFactoryBuilder sfb) {
if (this.transactionManager != null) {
configurationTransactionManagerHolder.set(this.transactionManager);
}
try {
return super.buildSessionFactory(sfb);
} finally {
if (this.transactionManager != null) {
configurationTransactionManagerHolder.set(null);
}
}
}
开发者ID:JadiraOrg,项目名称:jadira,代码行数:17,代码来源:HibernateSessionFactoryBean.java
示例3: sessionFactory
import org.springframework.orm.hibernate5.LocalSessionFactoryBuilder; //导入依赖的package包/类
@Bean
public SessionFactory sessionFactory() {
LocalSessionFactoryBuilder builder = new LocalSessionFactoryBuilder(
dataSource());
builder.scanPackages("com.hantsylabs.example.spring.model")
.addProperties(hibernateProperties());
return builder.buildSessionFactory();
}
开发者ID:hantsy,项目名称:spring4-sandbox,代码行数:10,代码来源:Hibernate5Config.java
示例4: getSessionFactory
import org.springframework.orm.hibernate5.LocalSessionFactoryBuilder; //导入依赖的package包/类
@Bean(name = "sessionFactory")
public SessionFactory getSessionFactory(DataSource dataSource) {
LocalSessionFactoryBuilder sessionBuilder = new LocalSessionFactoryBuilder(dataSource);
sessionBuilder.scanPackages("com.book.healthapp.domain");
return sessionBuilder.buildSessionFactory();
}
开发者ID:PacktPublishing,项目名称:Building-Web-Apps-with-Spring-5-and-Angular,代码行数:7,代码来源:AppConfig.java
注:本文中的org.springframework.orm.hibernate5.LocalSessionFactoryBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论