Java Code Examples for org.hibernate.jpa.boot.spi.PersistenceUnitDescriptor#getProviderClassName()

The following examples show how to use org.hibernate.jpa.boot.spi.PersistenceUnitDescriptor#getProviderClassName() . 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: FastBootHibernateReactivePersistenceProvider.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@Override
public EntityManagerFactory createEntityManagerFactory(String emName, Map properties) {
    if (properties == null)
        properties = new HashMap<Object, Object>();
    try {
        // These are pre-parsed during image generation:
        final List<PersistenceUnitDescriptor> units = PersistenceUnitsHolder.getPersistenceUnitDescriptors();

        for (PersistenceUnitDescriptor unit : units) {
            //if the provider is not set, don't use it as people might want to use Hibernate ORM
            if (IMPLEMENTATION_NAME.equalsIgnoreCase(unit.getProviderClassName()) ||
                    unit.getProviderClassName() == null) {
                EntityManagerFactoryBuilder emfBuilder = getEntityManagerFactoryBuilderOrNull(emName, properties);
                EntityManagerFactory emf = emfBuilder.build();
                return emf;
            }
        }

        //not the right provider
        return null;
    } catch (PersistenceException pe) {
        throw pe;
    } catch (Exception e) {
        throw new PersistenceException("Unable to build EntityManagerFactory", e);
    }
}
 
Example 2
Source File: LightPersistenceXmlDescriptor.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public LightPersistenceXmlDescriptor(final PersistenceUnitDescriptor toClone) {
    this.name = toClone.getName();
    this.providerClassName = toClone.getProviderClassName();
    this.useQuotedIdentifiers = toClone.isUseQuotedIdentifiers();
    this.transactionType = toClone.getTransactionType();
    this.validationMode = toClone.getValidationMode();
    this.sharedCachemode = toClone.getSharedCacheMode();
    this.managedClassNames = Collections.unmodifiableList(toClone.getManagedClassNames());
    this.properties = toClone.getProperties();
    verifyIgnoredFields(toClone);
}
 
Example 3
Source File: ReactiveProviderChecker.java    From hibernate-reactive with GNU Lesser General Public License v2.1 4 votes vote down vote up
private static String extractProviderName(PersistenceUnitDescriptor persistenceUnit) {
    final String persistenceUnitRequestedProvider = persistenceUnit.getProviderClassName();
    return persistenceUnitRequestedProvider == null ? null : persistenceUnitRequestedProvider.trim();
}
 
Example 4
Source File: FastBootHibernatePersistenceProvider.java    From quarkus with Apache License 2.0 4 votes vote down vote up
private static String extractProviderName(PersistenceUnitDescriptor persistenceUnit) {
    final String persistenceUnitRequestedProvider = persistenceUnit.getProviderClassName();
    return persistenceUnitRequestedProvider == null ? null : persistenceUnitRequestedProvider.trim();
}