@Inject public DataSource dataSource; @Inject public JpaProperties prop; @Bean("sessionFactory") @Primary public LocalSessionFactoryBean getSessionFactory() { LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(dataSource); sessionFactory.setPackagesToScan(new String[] { "org.roshan" }); sessionFactory.setAnnotatedPackages(new String[] { "org.roshan" }); sessionFactory.setHibernateProperties(getHibernateProperties()); return sessionFactory; } private Properties getHibernateProperties() { Properties p = new Properties(); p.putAll(prop.getProperties()); p.put(AvailableSettings.HBM2DDL_AUTO, prop.getHibernate().getDdlAuto()); return p; }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)