Java Code Examples for org.springframework.orm.hibernate5.LocalSessionFactoryBuilder#buildSessionFactory()

The following examples show how to use org.springframework.orm.hibernate5.LocalSessionFactoryBuilder#buildSessionFactory() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Hibernate5Config.java    From spring4-sandbox with Apache License 2.0 5 votes vote down vote up
@Bean
public SessionFactory sessionFactory() {
	LocalSessionFactoryBuilder builder = new LocalSessionFactoryBuilder(
			dataSource());
	builder.scanPackages("com.hantsylabs.example.spring.model")
			.addProperties(hibernateProperties());

	return builder.buildSessionFactory();
}
 
Example 2
Source File: AppConfig.java    From Building-Web-Apps-with-Spring-5-and-Angular with MIT License 4 votes vote down vote up
@Bean(name = "sessionFactory")
public SessionFactory getSessionFactory(DataSource dataSource) {
    LocalSessionFactoryBuilder sessionBuilder = new LocalSessionFactoryBuilder(dataSource);
    sessionBuilder.scanPackages("com.book.healthapp.domain");
    return sessionBuilder.buildSessionFactory();
}
 
Example 3
Source File: AppConfig.java    From Building-Web-Apps-with-Spring-5-and-Angular with MIT License 4 votes vote down vote up
@Bean(name = "sessionFactory")
public SessionFactory getSessionFactory(DataSource dataSource) {
    LocalSessionFactoryBuilder sessionBuilder = new LocalSessionFactoryBuilder(dataSource);
    sessionBuilder.scanPackages("com.book.healthapp.domain");
    return sessionBuilder.buildSessionFactory();
}