Example usage for org.hibernate.cfg AvailableSettings SCANNER

List of usage examples for org.hibernate.cfg AvailableSettings SCANNER

Introduction

In this page you can find the example usage for org.hibernate.cfg AvailableSettings SCANNER.

Prototype

String SCANNER

To view the source code for org.hibernate.cfg AvailableSettings SCANNER.

Click Source Link

Document

Pass an implementation of org.hibernate.boot.archive.scan.spi.Scanner .

Usage

From source file:org.jboss.as.jpa.hibernate.HibernatePersistenceProviderAdaptor.java

License:Open Source License

@Override
public void addProviderProperties(Map properties, PersistenceUnitMetadata pu) {
    properties.put(Configuration.USE_NEW_ID_GENERATOR_MAPPINGS, "true");
    properties.put(org.hibernate.ejb.AvailableSettings.SCANNER,
            "org.jboss.as.jpa.hibernate.HibernateAnnotationScanner");
    properties.put(AvailableSettings.APP_CLASSLOADER, pu.getClassLoader());
    properties.put(AvailableSettings.JTA_PLATFORM, new JBossAppServerJtaPlatform());
}

From source file:org.jboss.as.jpa.hibernate4.HibernatePersistenceProviderAdaptor.java

License:Open Source License

@SuppressWarnings("deprecation")
@Override/*from www  .j av  a2  s .c  o m*/
public void addProviderProperties(Map properties, PersistenceUnitMetadata pu) {
    putPropertyIfAbsent(pu, properties, AvailableSettings.JPAQL_STRICT_COMPLIANCE, "true"); // JIPI-24 ignore jpql aliases case
    putPropertyIfAbsent(pu, properties, Configuration.USE_NEW_ID_GENERATOR_MAPPINGS, "true");
    putPropertyIfAbsent(pu, properties, org.hibernate.ejb.AvailableSettings.SCANNER,
            HibernateArchiveScanner.class.getName());
    properties.put(AvailableSettings.APP_CLASSLOADER, pu.getClassLoader());
    putPropertyIfAbsent(pu, properties, AvailableSettings.JTA_PLATFORM,
            new JBossAppServerJtaPlatform(jtaManager));
    putPropertyIfAbsent(pu, properties, org.hibernate.ejb.AvailableSettings.ENTITY_MANAGER_FACTORY_NAME,
            pu.getScopedPersistenceUnitName());
    putPropertyIfAbsent(pu, properties, AvailableSettings.SESSION_FACTORY_NAME,
            pu.getScopedPersistenceUnitName());
    if (!pu.getProperties().containsKey(AvailableSettings.SESSION_FACTORY_NAME)) {
        putPropertyIfAbsent(pu, properties, AvailableSettings.SESSION_FACTORY_NAME_IS_JNDI, Boolean.FALSE);
    }
}

From source file:org.jboss.as.jpa.hibernate5.HibernatePersistenceProviderAdaptor.java

License:Apache License

@SuppressWarnings("deprecation")
@Override/* ww  w.ja  v a 2  s . c  o m*/
public void addProviderProperties(Map properties, PersistenceUnitMetadata pu) {
    putPropertyIfAbsent(pu, properties, AvailableSettings.JPAQL_STRICT_COMPLIANCE, "true"); // JIPI-24 ignore jpql aliases case
    putPropertyIfAbsent(pu, properties, AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "true");
    putPropertyIfAbsent(pu, properties, AvailableSettings.KEYWORD_AUTO_QUOTING_ENABLED, "false");
    putPropertyIfAbsent(pu, properties, AvailableSettings.IMPLICIT_NAMING_STRATEGY,
            NAMING_STRATEGY_JPA_COMPLIANT_IMPL);
    putPropertyIfAbsent(pu, properties, AvailableSettings.SCANNER, HibernateArchiveScanner.class);
    properties.put(AvailableSettings.APP_CLASSLOADER, pu.getClassLoader());
    putPropertyIfAbsent(pu, properties, AvailableSettings.JTA_PLATFORM,
            new JBossAppServerJtaPlatform(jtaManager));
    putPropertyIfAbsent(pu, properties, org.hibernate.ejb.AvailableSettings.ENTITY_MANAGER_FACTORY_NAME,
            pu.getScopedPersistenceUnitName());
    putPropertyIfAbsent(pu, properties, AvailableSettings.SESSION_FACTORY_NAME,
            pu.getScopedPersistenceUnitName());
    if (!pu.getProperties().containsKey(AvailableSettings.SESSION_FACTORY_NAME)) {
        putPropertyIfAbsent(pu, properties, AvailableSettings.SESSION_FACTORY_NAME_IS_JNDI, Boolean.FALSE);
    }
}

From source file:org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties.java

License:Apache License

private void applyScanner(Map<String, Object> result) {
    if (!result.containsKey(AvailableSettings.SCANNER) && ClassUtils.isPresent(DISABLED_SCANNER_CLASS, null)) {
        result.put(AvailableSettings.SCANNER, DISABLED_SCANNER_CLASS);
    }//  w w  w  .j  av  a2 s.co  m
}

From source file:org.springframework.boot.autoconfigure.orm.jpa.HibernatePropertiesTests.java

License:Apache License

@Test
public void scannerUsesDisabledScannerByDefault() {
    this.contextRunner.run(assertHibernateProperties(
            (hibernateProperties) -> assertThat(hibernateProperties).containsEntry(AvailableSettings.SCANNER,
                    "org.hibernate.boot.archive.scan.internal.DisabledScanner")));
}

From source file:org.springframework.boot.autoconfigure.orm.jpa.HibernatePropertiesTests.java

License:Apache License

@Test
public void scannerCanBeCustomized() {
    this.contextRunner.withPropertyValues(
            "spring.jpa.properties.hibernate.archive.scanner:org.hibernate.boot.archive.scan.internal.StandardScanner")
            .run(assertHibernateProperties((hibernateProperties) -> assertThat(hibernateProperties)
                    .containsEntry(AvailableSettings.SCANNER,
                            "org.hibernate.boot.archive.scan.internal.StandardScanner")));
}