org.springframework.orm.hibernate5.LocalSessionFactoryBuilder Java Examples

The following examples show how to use org.springframework.orm.hibernate5.LocalSessionFactoryBuilder. 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: TestDataConfig.java    From Spring with Apache License 2.0 5 votes vote down vote up
@Bean
public SessionFactory sessionFactory() {
	return new LocalSessionFactoryBuilder(dataSource())
			.scanPackages("com.ps.ents")
			.addProperties(hibernateProperties())
			.buildSessionFactory();
}
 
Example #2
Source File: TestDataConfig.java    From Spring with Apache License 2.0 5 votes vote down vote up
@Bean
public SessionFactory sessionFactory() {
    return new LocalSessionFactoryBuilder(dataSource())
            .scanPackages("com.ps.ents")
            .addProperties(hibernateProperties())
            .buildSessionFactory();
}
 
Example #3
Source File: HibernateSessionFactoryBean.java    From jadira with Apache License 2.0 5 votes vote down vote up
@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);
        }
    }
}
 
Example #4
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 #5
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 #6
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();
}