/** * Sets custom naming strategy specified in configuration or the default {@link * ImprovedNamingStrategy}. */ private void configureNamingStrategy() { NamingStrategy strategy = null; Object customStrategy = grailsApplication.getFlatConfig().get("hibernate.naming_strategy"); if (customStrategy != null) { Class<?> namingStrategyClass = null; if (customStrategy instanceof Class<?>) { namingStrategyClass = (Class<?>) customStrategy; } else { try { namingStrategyClass = grailsApplication.getClassLoader().loadClass(customStrategy.toString()); } catch (ClassNotFoundException e) { // ignore } } if (namingStrategyClass != null) { try { strategy = (NamingStrategy) namingStrategyClass.newInstance(); } catch (InstantiationException e) { // ignore } catch (IllegalAccessException e) { // ignore } } } if (strategy == null) { strategy = ImprovedNamingStrategy.INSTANCE; } setNamingStrategy(strategy); }