title: ImprovedNamingStrategy no longer working in Hibernate 5
body: <p>I have simple spring-jpa configuration where I have configured Hibernate's <code>ImprovedNamingStrategy</code>. This means if my entity class has a variable <code>userName</code>, then Hibernate should convert it to <code>user_name</code> for querying the database. But this naming conversion stopped working after I upgraded to Hibernate 5. I am getting the error:</p>
  
  <blockquote>
    <p>ERROR: Unknown column 'user0_.userName' in 'field list'</p>
  </blockquote>
  
  <p>This is my Hibernate config:</p>
  
  <pre><code>@Configuration
  @EnableJpaRepositories("com.springJpa.repository")
  @EnableTransactionManagement
  public class DataConfig {
  
      @Bean
      public DataSource dataSource(){
          DriverManagerDataSource ds = new DriverManagerDataSource();
          ds.setDriverClassName("com.mysql.jdbc.Driver");
          ds.setUrl("jdbc:mysql://localhost:3306/test");
          ds.setUsername("root");
          ds.setPassword("admin");
          return ds;
      }
  
  
      @Bean
      public LocalContainerEntityManagerFactoryBean entityManagerFactory(){ 
  
          HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
          vendorAdapter.setShowSql(Boolean.TRUE);
          vendorAdapter.setDatabase(Database.MYSQL);
  
          LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
          factory.setJpaVendorAdapter(vendorAdapter);
          factory.setDataSource(dataSource());
          factory.setPackagesToScan("com.springJpa.entity");
  
  
          Properties jpaProperties = new Properties();
  
          jpaProperties.put("hibernate.ejb.naming_strategy","org.hibernate.cfg.ImprovedNamingStrategy");
          jpaProperties.put("hibernate.dialect","org.hibernate.dialect.MySQL5InnoDBDialect");
  
          factory.setJpaProperties(jpaProperties);
          factory.afterPropertiesSet();
          return factory;
      }
  
      @Bean
      public SharedEntityManagerBean entityManager() {
          SharedEntityManagerBean entityManager = new SharedEntityManagerBean();
          entityManager.setEntityManagerFactory(entityManagerFactory().getObject());
          return entityManager;
      }
  
  
  
      @Bean
      public PlatformTransactionManager transactionManager() {
          JpaTransactionManager txManager = new JpaTransactionManager();
          txManager.setEntityManagerFactory(entityManagerFactory().getObject());
          return txManager;
      }
  
      @Bean
      public ImprovedNamingStrategy namingStrategy(){
          return new ImprovedNamingStrategy();
      }
  }
  </code></pre>
  
  <p>This is my Entity class:</p>
  
  <pre><code>@Getter
  @Setter
  @Entity
  @Table(name="user")
  public class User{
  
      @Id
      @GeneratedValue
      private Long id;
  
      private String userName;
      private String email;
      private String password;
      private String role;
  
  }
  </code></pre>
  
  <p>I don't want to explicitly name my database fields within the @Column annotations. I want my configuration which can implicitly convert camel case to underscore.</p>
  
  <p>Please guide.</p>