5 Replies Latest reply on Jan 21, 2009 11:42 AM by Thomas Hamacher

    Deploying multiple ears with

    Thomas Hamacher Novice

      Hi,

      I am currently facing the following problem:
      I need to configure my ear for multiple environments. Therefor I used the hibernate.properties in the root folder of the ear to configure my persistence-layer. This works perfectly so far, because Hibernate finds the properties through it´s Environment and loads them.

      BUT:

      if I now deploy another ear, holding a hibernate.properties for configuring the second application, the hibernate.properties are simply ignored and - even more - the hibernate.properties from the first deployment are used for my second deployment as well.

      While looking in the Hibernate source code I saw that the corresponding variable is defined as a static variable.

      private static final Properties GLOBAL_PROPERTIES;


      It seems as if this class will be loaded only once and the first deployment wins. I already tried to work with isolated classloaders and set the value for
      <attribute name="Isolated">true</attribute>
      


      in the ear-deployer.xml to false. But this didn´t make any difference.

      Does anyone has an idea how to use multiple hibernate.properties or any other way to handle multiple configurations for the persistence-layer?

      Thanks for any input

      Thomas