title: Spring + Hibernate Search dynamic configuraion
body: <p>I'm currently trying to configure hibernate search via spring across 3 machines for the purpose of using a JMS distributed index. Due to the way we deploy our software I have to use the same configuration across all three machines but I need a way to set one of them to be the JMS Master.</p>
  
  <p>Currently hibernate is being configured via Spring using the following bean declaration:</p>
  
  <pre><code>&lt;bean class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
  id="productSessionFactory"&gt;
      &lt;property name="dataSource"&gt;
          &lt;ref local="productDataSource"/&gt;
      &lt;/property&gt;
      &lt;property name="configLocation"&gt;
          &lt;value&gt;classpath:hibernate.cfg.xml&lt;/value&gt;
      &lt;/property&gt;
      &lt;property name="entityInterceptor" ref="builderInterceptor"/&gt;
      &lt;property name="eventListeners"&gt;
          &lt;map key-type="java.lang.String" value-type="java.lang.Object"&gt;
              &lt;entry key="save" value-ref="saveEventListener"/&gt;
          &lt;/map&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>On one of the three machines I need to set the property hibernate.search.default.directory_provider to filesystem-master and on the other two I need to set it to filesystem-slave. </p>
  
  <p>I have the ability to set flags on the individual machines to identify which machine should be the master but due to all the configuration being XML I dont have any ability to add logic to set the parameters correctly. </p>
  
  <p>Is there an way to set this parameter programmatically while leaving the rest of the configuration alone?</p>
  
  <p>Thanks!</p>