title: How to pass the table name through external properties
body: <p>I need to pass the <code>@Table</code> name from the config as per the environment. Here is what I tried:</p>
  <pre><code>public class CustomNamingStrategy extends SpringPhysicalNamingStrategy {
  
      //Making this field as static works but not the instance variable
      private static String tableName;
  
      //This is an instance method. Using this to set the static value does not seem to be a good practice. findbugs also complains on this.
      @Value(&quot;${my-app.prop.tableName}&quot;)
      public void setTableName(String tableName) {
          CustomNamingStrategy.tableName = tableName;
      }
  
      @Override
      public Identifier toPhysicalTableName(
              Identifier name, JdbcEnvironment context
      ) {
          if (TABLE_NAME.equals(&quot;PLACEHOLDER&quot;)) {
              System.out.println(&quot;table name is: &quot; + CustomNamingStrategy.tableName);
              return Identifier.toIdentifier(CustomNamingStrategy.tableName);
          }
          return super.toPhysicalTableName(name,context);
      }
  }
  </code></pre>
  <p>Also, set the physical naming strategy like this:
  <code>properties.put(&quot;hibernate.physical_naming_strategy&quot;, CustomNamingStrategy.class.getName());</code></p>
  <ul>
  <li>Why does it work when I declare the tableName property as static but not as instance variable?</li>
  <li>What do I need to do to make this work without declaring it static? Is it even possible? When I try with instance variable the value is correctly logged in the <code>constructor</code> but the same value is null in the overridden method <code>toPhysicalTableName</code></li>
  </ul>