*/
@Bean
public SessionFactory sessionFactory() throws IOException {
log.info("SessionFactory Bean을 생성합니다...");
LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();
String[] packagenames = getMappedPackageNames();
if (packagenames != null && packagenames.length > 0) {
log.debug("hibernate용 entity를 scan합니다. packages=[{}]", arrayToCommaDelimitedString(packagenames));
factoryBean.setPackagesToScan(packagenames);
}
// Naming strategy
NamingStrategy ns = getNamingStrategy();
if (ns != null)
factoryBean.setNamingStrategy(ns);
// Hibernate properties
factoryBean.setHibernateProperties(hibernateProperties());
factoryBean.setDataSource(dataSource());
Interceptor interceptor = hibernateInterceptor();
if (interceptor != null)
factoryBean.setEntityInterceptor(hibernateInterceptor());
setupSessionFactory(factoryBean);
factoryBean.afterPropertiesSet();
log.info("SessionFactory Bean을 생성했습니다!!!");
return factoryBean.getObject();
}