Example usage for org.hibernate.cfg AvailableSettings IMPLICIT_NAMING_STRATEGY

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

Introduction

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

Prototype

String IMPLICIT_NAMING_STRATEGY

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

Click Source Link

Document

Used to specify the org.hibernate.boot.model.naming.ImplicitNamingStrategy class to use.

Usage

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

License:Apache License

@SuppressWarnings("deprecation")
@Override/*from   www  . j  a  v a 2 s.  c  om*/
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.HibernatePropertiesTests.java

License:Apache License

@Test
public void noCustomNamingStrategy() {
    this.contextRunner.run(assertHibernateProperties((hibernateProperties) -> {
        assertThat(hibernateProperties).doesNotContainKeys("hibernate.ejb.naming_strategy");
        assertThat(hibernateProperties).containsEntry(AvailableSettings.PHYSICAL_NAMING_STRATEGY,
                SpringPhysicalNamingStrategy.class.getName());
        assertThat(hibernateProperties).containsEntry(AvailableSettings.IMPLICIT_NAMING_STRATEGY,
                SpringImplicitNamingStrategy.class.getName());
    }));//  w w w  .  jav a  2 s .c  om
}

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

License:Apache License

@Test
public void hibernate5CustomNamingStrategies() {
    this.contextRunner
            .withPropertyValues("spring.jpa.hibernate.naming.implicit-strategy:com.example.Implicit",
                    "spring.jpa.hibernate.naming.physical-strategy:com.example.Physical")
            .run(assertHibernateProperties((hibernateProperties) -> {
                assertThat(hibernateProperties).contains(
                        entry(AvailableSettings.IMPLICIT_NAMING_STRATEGY, "com.example.Implicit"),
                        entry(AvailableSettings.PHYSICAL_NAMING_STRATEGY, "com.example.Physical"));
                assertThat(hibernateProperties).doesNotContainKeys("hibernate.ejb.naming_strategy");
            }));//  w  w  w.j av  a  2s . c  o  m
}

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

License:Apache License

@Test
public void hibernate5CustomNamingStrategiesViaJpaProperties() {
    this.contextRunner
            .withPropertyValues("spring.jpa.properties.hibernate.implicit_naming_strategy:com.example.Implicit",
                    "spring.jpa.properties.hibernate.physical_naming_strategy:com.example.Physical")
            .run(assertHibernateProperties((hibernateProperties) -> {
                // You can override them as we don't provide any default
                assertThat(hibernateProperties).contains(
                        entry(AvailableSettings.IMPLICIT_NAMING_STRATEGY, "com.example.Implicit"),
                        entry(AvailableSettings.PHYSICAL_NAMING_STRATEGY, "com.example.Physical"));
                assertThat(hibernateProperties).doesNotContainKeys("hibernate.ejb.naming_strategy");
            }));//from   w  w w.  j a  va2 s  .com
}