Search code examples
javasql-serverhibernatenaming-conventionshbm2ddl

Hibernate ImprovedNamingStrategy not working correctly


using this in my hibernate cfg:

<property name="hibernate.ejb.naming_strategy">org.hibernate.cfg.ImprovedNamingStrategy</property>
<property name="hibernate.hbm2ddl.auto">create</property>

This should make all my tables and column snake_case in database.

But it is just making them camelCase.

What could be the problem?

private String myName;

in my database it is still myName(varchar(255))


Solution

  • Setting hibernate.ejb.naming_strategy programmatically worked.

    configuration.setNamingStrategy(ImprovedNamingStrategy.INSTANCE);
    

    http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/session-configuration.html#configuration-programmatic

    Still wondering why it didn't work from XML, should work.