Hibernate is not using custom implementation of PhysicalNamingStrategy

1 day ago 3
ARTICLE AD BOX

In my unit test I want to use my custom implementation of PhysicalNamingStrategy:

public class CustomPhysicalNamingStrategyStandardImpl implements PhysicalNamingStrategy { @Override public Identifier toPhysicalCatalogName(Identifier identifier, JdbcEnvironment jdbcEnvironment) { return null; ... }

This is my configuration:

<jdbc:embedded-database id="dataSource" type="H2"/> <bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.H2Dialect</prop> <prop key="hibernate.hbm2ddl.auto">create-drop</prop> <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.internal.NoCachingRegionFactory</prop> <prop key="hibernate.cache.use_query_cache">false</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.physical_naming_strategy">com.mydomain.CustomPhysicalNamingStrategyStandardImpl</prop> </props> </property> </bean>

Despite the configuration above, Hibernate is still using the standard implementation of PhysicalNamingStrategy (org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImplthat is).

I have tried the key value hibernate.naming.physical_strategy, but it didn't work.

I have also verified that the other properties are being effective, for example by switching the value of hibernate.show_sql.

What am I missing here, how do I fix it?

I am using Spring Framework 6.0.13 and Hibernate 6.2.13.

Read Entire Article