Example usage for org.springframework.orm.jpa JpaVendorAdapter getJpaDialect

List of usage examples for org.springframework.orm.jpa JpaVendorAdapter getJpaDialect

Introduction

In this page you can find the example usage for org.springframework.orm.jpa JpaVendorAdapter getJpaDialect.

Prototype

@Nullable
default JpaDialect getJpaDialect() 

Source Link

Document

Return the vendor-specific JpaDialect implementation for this provider, or null if there is none.

Usage

From source file:org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.java

@Override
public void afterPropertiesSet() throws PersistenceException {
    JpaVendorAdapter jpaVendorAdapter = getJpaVendorAdapter();
    if (jpaVendorAdapter != null) {
        if (this.persistenceProvider == null) {
            this.persistenceProvider = jpaVendorAdapter.getPersistenceProvider();
        }//from   w w w. j  a  v a  2  s  . c  o  m
        PersistenceUnitInfo pui = getPersistenceUnitInfo();
        Map<String, ?> vendorPropertyMap = (pui != null ? jpaVendorAdapter.getJpaPropertyMap(pui)
                : jpaVendorAdapter.getJpaPropertyMap());
        if (!CollectionUtils.isEmpty(vendorPropertyMap)) {
            vendorPropertyMap.forEach((key, value) -> {
                if (!this.jpaPropertyMap.containsKey(key)) {
                    this.jpaPropertyMap.put(key, value);
                }
            });
        }
        if (this.entityManagerFactoryInterface == null) {
            this.entityManagerFactoryInterface = jpaVendorAdapter.getEntityManagerFactoryInterface();
            if (!ClassUtils.isVisible(this.entityManagerFactoryInterface, this.beanClassLoader)) {
                this.entityManagerFactoryInterface = EntityManagerFactory.class;
            }
        }
        if (this.entityManagerInterface == null) {
            this.entityManagerInterface = jpaVendorAdapter.getEntityManagerInterface();
            if (!ClassUtils.isVisible(this.entityManagerInterface, this.beanClassLoader)) {
                this.entityManagerInterface = EntityManager.class;
            }
        }
        if (this.jpaDialect == null) {
            this.jpaDialect = jpaVendorAdapter.getJpaDialect();
        }
    }

    AsyncTaskExecutor bootstrapExecutor = getBootstrapExecutor();
    if (bootstrapExecutor != null) {
        this.nativeEntityManagerFactoryFuture = bootstrapExecutor.submit(this::buildNativeEntityManagerFactory);
    } else {
        this.nativeEntityManagerFactory = buildNativeEntityManagerFactory();
    }

    // Wrap the EntityManagerFactory in a factory implementing all its interfaces.
    // This allows interception of createEntityManager methods to return an
    // application-managed EntityManager proxy that automatically joins
    // existing transactions.
    this.entityManagerFactory = createEntityManagerFactoryProxy(this.nativeEntityManagerFactory);
}