@Bean public LocalSessionFactoryBean sessionFactory() { LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(dataSource()); sessionFactory.setPackagesToScan("pl.brzeznik.aj"); return sessionFactory; }
@Bean public LocalSessionFactoryBean sessionFactory() { LocalSessionFactoryBean sessionFactoryBean = new LocalSessionFactoryBean(); sessionFactoryBean.setDataSource(dataSource()); sessionFactoryBean.setPackagesToScan(env.getRequiredProperty(PACKAGES_TO_SCAN)); sessionFactoryBean.setHibernateProperties(hibProperties()); return sessionFactoryBean; }
@Bean public LocalSessionFactoryBean sessionFactory() { LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(dataSource()); sessionFactory.setPackagesToScan(new String[] {"com.barban.model"}); sessionFactory.setHibernateProperties(hibernateProperties()); return sessionFactory; }
@Bean public LocalSessionFactoryBean sessionFactory() { LocalSessionFactoryBean sessionFactoryBean = new LocalSessionFactoryBean(); sessionFactoryBean.setDataSource(dataSource()); sessionFactoryBean.setPackagesToScan("com.web.sinhhoc"); sessionFactoryBean.setHibernateProperties(hibernateProperties()); return sessionFactoryBean; }
@Bean public LocalSessionFactoryBean sessionFactory() { LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(getDataSource()); sessionFactory.setPackagesToScan(new String[] {"com.gee.entity"}); sessionFactory.setHibernateProperties(getHibernateProperties()); return sessionFactory; }
@Bean public LocalSessionFactoryBean sessionFactory() { LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(dataSource()); sessionFactory.setPackagesToScan(new String[] {"org.marist.sdd.projects.pojo"}); sessionFactory.setHibernateProperties(hibernateProperties()); return sessionFactory; }
@Bean public LocalSessionFactoryBean localSessionFactoryBean() { LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(basicDataSource()); sessionFactory.setHibernateProperties(getHibernateProperties()); sessionFactory.setPackagesToScan(new String[] {"pl.hotel.control.orm"}); return sessionFactory; }
@Bean public LocalSessionFactoryBean sessionFactory() { LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(dataSource()); sessionFactory.setPackagesToScan("com.madislav.store.model"); sessionFactory.setHibernateProperties(hibernateProperties()); return sessionFactory; }
/* @Bean public SessionFactory sessionFactory(){ org.springframework.orm.hibernate4.LocalSessionFactoryBuilder sessionF= new org.springframework.orm.hibernate4.LocalSessionFactoryBuilder(dataSource()); //sessionF.setDataSource(new com.mycompany.dbinspring.DataSourceConfig().dataSource()); sessionF.scanPackages("com.mycompany.hibernateinspring"); sessionF.setProperties(hibernateProperties()); return sessionF.buildSessionFactory(); }*/ @Bean public LocalSessionFactoryBean sessionFactory() { LocalSessionFactoryBean sessionF = new LocalSessionFactoryBean(); sessionF.setDataSource(dataSource()); sessionF.setPackagesToScan("com.mycompany.hibernateinspring"); sessionF.setHibernateProperties(hibernateProperties()); // sessionF.setJtaTransactionManager(jtaTrxManager()); return sessionF; }
@Bean public LocalSessionFactoryBean SessionFactory() { LocalSessionFactoryBean lsfb = new LocalSessionFactoryBean(); lsfb.setDataSource(getDefaultDataSource()); lsfb.setPackagesToScan("com.yj.model"); lsfb.setHibernateProperties(getDefaultProperties()); lsfb.setNamingStrategy(ImprovedNamingStrategy.INSTANCE); return lsfb; }
@Bean public LocalSessionFactoryBean sessionFactory() { LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(dataSource()); sessionFactory.setPackagesToScan( new String[] {environment.getRequiredProperty("entitymanager.packages.to.scan")}); sessionFactory.setHibernateProperties(hibernateProperties()); return sessionFactory; }
/** * SessionFactory management * * @return sessionFactory */ @Bean(name = "sessionFactory") public LocalSessionFactoryBean sessionFactory() { LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(dataSource()); sessionFactory.setPackagesToScan( env.getRequiredProperty(PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN)); sessionFactory.setHibernateProperties(hibernateProperties()); return sessionFactory; }
@Bean @Autowired public LocalSessionFactoryBean sessionFactory(DataSource dataSource) { LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(dataSource); sessionFactory.setPackagesToScan(new String[] {"com.demoproject.springmvc.domain"}); sessionFactory.setHibernateProperties(getHibernateProperties()); return sessionFactory; }
/** Integrazione con Hibernate */ @Bean public LocalSessionFactoryBean sessionFactory(DataSource dataSource) { LocalSessionFactoryBean sfb = new LocalSessionFactoryBean(); sfb.setDataSource(dataSource); sfb.setPackagesToScan(new String[] {"it.albertus.spring.model"}); Properties props = new Properties(); props.setProperty("hibernate.dialect", "org.hibernate.dialect.Oracle10gDialect"); props.setProperty("hibernate.show_sql", Boolean.TRUE.toString()); sfb.setHibernateProperties(props); return sfb; }
@Bean @DependsOn("flyway") public LocalSessionFactoryBean sessionFactory() { LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(dataSource()); sessionFactory.setPackagesToScan("ru.admworks.utips.models"); Properties hibernateProperties = new Properties(); hibernateProperties.setProperty("hibernate.dialect", hibernateDialect); sessionFactory.setHibernateProperties(hibernateProperties); return sessionFactory; }
@Bean public LocalSessionFactoryBean sessionFactory(DataSource dataSource) { LocalSessionFactoryBean bean = new LocalSessionFactoryBean(); bean.setDataSource(dataSource); bean.setPackagesToScan(ENTITIES_ROOT); Properties props = new Properties(); props.put("hibernate.dialect", DATABASE_DIALECT); props.put("ddl-auto", "create-drop"); props.put("show-sql", true); bean.setHibernateProperties(props); return bean; }
@Bean public LocalSessionFactoryBean setupSessionFactory(DataSource dataSource) { LocalSessionFactoryBean sessionFactoryBean = new LocalSessionFactoryBean(); sessionFactoryBean.setDataSource(dataSource); sessionFactoryBean.setPackagesToScan("com.dohbedoh.model"); Properties hibernateProperties = new Properties(); hibernateProperties.setProperty( "hibernate.dialect", environment.getProperty("hibernate.dialect")); hibernateProperties.setProperty( "hibernate.show_sql", environment.getProperty("hibernate.show_sql")); hibernateProperties.setProperty( "hibernate.format_sql", environment.getProperty("hibernate.format_sql")); sessionFactoryBean.setHibernateProperties(hibernateProperties); return sessionFactoryBean; }
@Bean(name = "sessionFactory") public SessionFactory sessionFactory() throws IOException { LocalSessionFactoryBean sessionFactoryBean = new LocalSessionFactoryBean(); sessionFactoryBean.setDataSource(dataSource()); sessionFactoryBean.setPackagesToScan("com.avol.domain"); sessionFactoryBean.setAnnotatedPackages("com.avol.domain"); sessionFactoryBean.setHibernateProperties(getHibernateProperties()); sessionFactoryBean.afterPropertiesSet(); return sessionFactoryBean.getObject(); }
@Bean public SessionFactory sessionFactory( DataSource dataSource, @Value("${hibernate.packagesToScan}") String packagesToScan, @Qualifier("hibernateProperties") Properties properties) throws Exception { LocalSessionFactoryBean sessionFactoryBean = new LocalSessionFactoryBean(); sessionFactoryBean.setDataSource(dataSource); sessionFactoryBean.setPackagesToScan(packagesToScan); sessionFactoryBean.setHibernateProperties(properties); sessionFactoryBean.afterPropertiesSet(); return sessionFactoryBean.getObject(); }
@Override public void afterPropertiesSet() throws IOException { super.afterPropertiesSet(); for (Map.Entry<String, DataSource> entry : dataSourceMap.entrySet()) { Connection connection = null; try { connection = entry.getValue().getConnection(); SchemaExport export = new SchemaExport(getConfiguration(), connection); export.setOutputFile(entry.getKey() + "-schema.sql"); export.setDelimiter(";"); // this must be changed in order to support create, drop, validate etc // export.execute(true, true, false, true); } catch (SQLException e) { throw new RuntimeException(e); } } }
@Autowired @Override public void setPackagesToScan(String... packagesToScan) { super.setPackagesToScan(packagesToScan); }
@Autowired @Override public void setHibernateProperties(Properties hibernateProperties) { super.setHibernateProperties(hibernateProperties); }
@Autowired @Override public void setDataSource(DataSource dataSource) { super.setDataSource(dataSource); }