2023-11-22 21:43:11 -08:00
|
|
|
package com.wisemapping.config;
|
|
|
|
|
2024-01-13 18:31:21 -08:00
|
|
|
import com.wisemapping.model.User;
|
|
|
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
|
|
|
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
2023-11-22 21:43:11 -08:00
|
|
|
import org.springframework.context.annotation.Configuration;
|
2023-11-27 21:08:28 -08:00
|
|
|
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
2024-01-13 18:31:21 -08:00
|
|
|
|
|
|
|
|
2023-11-22 21:43:11 -08:00
|
|
|
@Configuration
|
2024-01-13 18:31:21 -08:00
|
|
|
@EnableAutoConfiguration
|
|
|
|
@EnableJpaRepositories(basePackages={"com.wisemapping.dao"})
|
|
|
|
@EntityScan(basePackageClasses= User.class)
|
2023-11-22 21:43:11 -08:00
|
|
|
public class HibernateConfig {
|
2023-11-24 19:26:36 -08:00
|
|
|
|
|
|
|
// @Bean
|
|
|
|
// public HibernateTransactionManager hibernateTransactionManager() {
|
|
|
|
// final HibernateTransactionManager result = new HibernateTransactionManager();
|
|
|
|
// result.setNestedTransactionAllowed(true);
|
|
|
|
// // @Todo: Am I creatting two instances ???
|
|
|
|
// result.setSessionFactory(sessionFactory().getObject());
|
|
|
|
// return result;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// private Properties hibernateProperties() {
|
|
|
|
// final Properties result = new Properties();
|
|
|
|
// result.setProperty("hibernate.dialect", dbDialect);
|
|
|
|
// result.setProperty("hibernate.default_batch_fetch_size", "200");
|
|
|
|
// result.setProperty("hibernate.nestedTransactionAllowed", "true");
|
|
|
|
// result.setProperty("hibernate.auto_quote_keyword", "true");
|
|
|
|
//
|
|
|
|
// return result;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// @Bean
|
|
|
|
// public DataSource dataSource() {
|
|
|
|
// final BasicDataSource result = new BasicDataSource();
|
|
|
|
// result.setDriverClassName(dbDriver);
|
|
|
|
// result.setUrl(dbUrl);
|
|
|
|
// result.setUsername(dbUsername);
|
|
|
|
// result.setPassword(dbPassword);
|
|
|
|
// result.setTestOnBorrow(dbSetOnBorrow);
|
|
|
|
//
|
|
|
|
// result.setDefaultQueryTimeout(15);
|
|
|
|
// result.setMaxTotal(100);
|
|
|
|
// result.setMaxIdle(30);
|
|
|
|
// result.setInitialSize(5);
|
|
|
|
// result.setMaxWaitMillis(10000);
|
|
|
|
// result.setValidationQuery(dbValQuery);
|
|
|
|
//
|
|
|
|
// return result;
|
|
|
|
// }
|
2023-11-22 21:43:11 -08:00
|
|
|
}
|