title: Unable to set NamingStrategy using Spring Boot + GORM + Gradle
body: <p>We're starting a new project using Spring Boot with GORM and Gradle. I've been able to configure most properties for hibernate, but I have so far been unable to find the correct way to set the <strong>naming strategy</strong>. </p>
  
  <h2>Attempts</h2>
  
  <p>I've tried setting a variety of properties in <strong>application.properties</strong> and adding the file <strong>hibernate.properties</strong>. We're using auto-configuration, and I see props are discovered and added in <strong>HibernateGormAutoConfiguration</strong>. </p>
  
  <p>I've also made some attempts creating the entity manager and session factory beans with no luck. </p>
  
  <p><strong>Examples from application.properties</strong> (trying all permutations): </p>
  
  <pre><code>spring.hibernate.hbm2ddl.auto=none # this works!!
  # from now on none works
  # I tried all permutations with combinations of
  # *.hibernate[.ejb].* and *.naming_strategy/naming-strategy
  spring.hibernate.namingStrategy=org.hibernate.cfg.DefaultNamingStrategy
  spring.hibernate.ejb.namingStrategy=org.hibernate.cfg.DefaultNamingStrategy
  spring.jpa.hibernate.namingStrategy=org.hibernate.cfg.DefaultNamingStrategy
  spring.properties.hibernate.namingStrategy=org.hibernate.cfg.DefaultNamingStrategy
  spring.jpa.properties.hibernate.namingStrategy=org.hibernate.cfg.DefaultNamingStrategy
  spring.gorm.hibernate.namingStrategy=org.hibernate.cfg.DefaultNamingStrategy
  spring.gorm.properties.hibernate.namingStrategy=org.hibernate.cfg.DefaultNamingStrategy
  gorm.hibernate.namingStrategy=org.hibernate.cfg.DefaultNamingStrategy
  </code></pre>
  
  <p><strong>Examples from src/main/resources/hibernate.properties:</strong> </p>
  
  <pre><code>hibernate.namingStrategy=org.hibernate.cfg.DefaultNamingStrategy
  hibernate.ejb.namingStrategy=org.hibernate.cfg.DefaultNamingStrategy
  </code></pre>
  
  <p><strong>Logging and stacktrace when starting application and trying to load entity:</strong></p>
  
  <pre><code>2014-11-03 10:12:04.381  INFO 81729 --- [           main] org.hibernate.cfg.Environment            : HHH000205: Loaded properties from ... 
  resource hibernate.properties: {hibernate.ejb.namingStrategy=org.hibernate.cfg.DefaultNamingStrategy, hibernate.namingStrategy=org.hibernate.cfg.DefaultNamingStrategy, hibernate.bytecode.use_reflection_optimizer=false}
  
  
  2014-11-03 10:09:28.825  WARN 81619 --- [nio-8080-exec-1] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 207, SQLState: 42S22
  2014-11-03 10:09:28.825 ERROR 81619 --- [nio-8080-exec-1] o.h.engine.jdbc.spi.SqlExceptionHelper   : Invalid column name 'origin_marking'.
  2014-11-03 10:09:28.839 ERROR 81619 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[jerseyServlet]        : Servlet.service() for servlet [jerseyServlet] in context with path [] threw exception [org.springframework.jdbc.BadSqlGrammarException: Hibernate operation: could not extract ResultSet; bad SQL grammar [n/a]; nested exception is java.sql.SQLException: Invalid column name 'origin_marking'.] with root cause
      java.sql.SQLException: Invalid column name 'origin_marking'.
      at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)
  </code></pre>
  
  <hr>
  
  <h2>Code examples</h2>
  
  <p>Unfortunately overriding field names on a per field basis is not a viable solution:</p>
  
  <pre><code>static mapping = {
      columns {
          originMarking column: 'originMarking'
      }
  }
  </code></pre>
  
  <p>Excerpts from the build files look like this: </p>
  
  <pre><code>.. // main build file
  buildscript {
      repositories {
          jcenter()
          maven { url "http://repo.spring.io/milestone" }
      }
      dependencies {
          classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.0.M2")
          classpath 'org.springframework:springloaded:1.2.0.RELEASE'
      }
  }
  ..
  apply plugin: 'spring-boot'
  ..
  .. // domain build file
  jar.baseName = 'domain'
  dependencies {
      compile "org.grails:gorm-hibernate4-spring-boot:1.1.0.RELEASE",
              "joda-time:joda-time:2.5",
              'org.jadira.usertype:usertype.jodatime:2.0.1',
              "commons-dbcp:commons-dbcp:1.4",
              "net.sourceforge.jtds:jtds:1.2.7"
      runtime "com.h2database:h2"
  }
  ..
  .. // api build file
  apply plugin: 'spring-boot'
  jar.baseName = 'api'
  dependencies {
      compile project(':domain')
      compile "org.springframework.boot:spring-boot-starter-jersey"
      ..
  }  
  </code></pre>
  
  <p>Any help would be highly appreciated!!</p>
  
  <hr>
  
  <p>This code is part of the same project as the question asked here: <a href="https://stackoverflow.com/questions/26626285/spring-boot-jersey-with-groovy-gradle-fails-on-startup">Spring boot Jersey with groovy/gradle fails on startup</a></p>