public static void configureNamingStrategy ( final String datasourceName , final Object strategy ) throws ClassNotFoundException , InstantiationException , IllegalAccessException { Class < ? > namingStrategyClass = null ; NamingStrategy namingStrategy ; if ( strategy instanceof Class < ? > ) { namingStrategyClass = ( Class < ? > ) strategy ; } else if ( strategy instanceof CharSequence ) { namingStrategyClass = Thread . currentThread ( ) . getContextClassLoader ( ) . loadClass ( strategy . toString ( ) ) ; } if ( namingStrategyClass == null ) { namingStrategy = ( NamingStrategy ) strategy ; } else { namingStrategy = ( NamingStrategy ) namingStrategyClass . newInstance ( ) ; } NAMING_STRATEGIES . put ( datasourceName , namingStrategy ) ; }
Override the default naming strategy given a Class or a full class name or an instance of a NamingStrategy .