core/cas-server-core-configuration/src/main/java/org/apereo/cas/configuration/support/Beans.java
/**
     * New entity manager factory bean.
     *
     * @param config        the config
     * @param jpaProperties the jpa properties
     * @return the local container entity manager factory bean
     */
New entity manager factory bean.
@param config        the config
@param jpaProperties the jpa properties
@return the local container entity manager factory bean
New entity manager factory bean . @param config the config @param jpaProperties the jpa properties @return the local container entity manager factory bean
public static LocalContainerEntityManagerFactoryBean newEntityManagerFactoryBean(final JpaConfigDataHolder config,
                                                                                     final AbstractJpaProperties jpaProperties) {
        final LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean();
        bean.setJpaVendorAdapter(config.getJpaVendorAdapter());
        if (StringUtils.isNotEmpty(config.getPersistenceUnitName())) {
            bean.setPersistenceUnitName(config.getPersistenceUnitName());
        }
        bean.setPackagesToScan(config.getPackagesToScan());
        bean.setDataSource(config.getDataSource());
        final Properties properties = new Properties();
        properties.put("hibernate.dialect", jpaProperties.getDialect());
        properties.put("hibernate.hbm2ddl.auto", jpaProperties.getDdlAuto());
        properties.put("hibernate.jdbc.batch_size", jpaProperties.getBatchSize());
        if (StringUtils.isNotBlank(jpaProperties.getDefaultCatalog())) {
            properties.put("hibernate.default_catalog", jpaProperties.getDefaultCatalog());
        }
        if (StringUtils.isNotBlank(jpaProperties.getDefaultSchema())) {
            properties.put("hibernate.default_schema", jpaProperties.getDefaultSchema());
        }
        bean.setJpaProperties(properties);
        return bean;
    }
public static LocalContainerEntityManagerFactoryBean newEntityManagerFactoryBean ( final JpaConfigDataHolder config , final AbstractJpaProperties jpaProperties ) { final LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean ( ) ; bean . setJpaVendorAdapter ( config . getJpaVendorAdapter ( ) ) ; if ( StringUtils . isNotEmpty ( config . getPersistenceUnitName ( ) ) ) { bean . setPersistenceUnitName ( config . getPersistenceUnitName ( ) ) ; } bean . setPackagesToScan ( config . getPackagesToScan ( ) ) ; bean . setDataSource ( config . getDataSource ( ) ) ; final Properties properties = new Properties ( ) ; properties . put ( "hibernate.dialect" , jpaProperties . getDialect ( ) ) ; properties . put ( "hibernate.hbm2ddl.auto" , jpaProperties . getDdlAuto ( ) ) ; properties . put ( "hibernate.jdbc.batch_size" , jpaProperties . getBatchSize ( ) ) ; if ( StringUtils . isNotBlank ( jpaProperties . getDefaultCatalog ( ) ) ) { properties . put ( "hibernate.default_catalog" , jpaProperties . getDefaultCatalog ( ) ) ; } if ( StringUtils . isNotBlank ( jpaProperties . getDefaultSchema ( ) ) ) { properties . put ( "hibernate.default_schema" , jpaProperties . getDefaultSchema ( ) ) ; } bean . setJpaProperties ( properties ) ; return bean ; }
New entity manager factory bean.
New entity manager factory bean .