6 Replies Latest reply on Dec 20, 2012 2:10 PM by tony.herstell1

    Externalising bits of persistence.xml

    tony.herstell1

      I can externalise my application properties to a file in the WAR.

        private static final String APPLICATION_PROPERTIES = "/xxx.properties";

        private Properties applicationProperties = new Properties();

         applicationProperties.load(PropertiesService.class.getResourceAsStream(APPLICATION_PROPERTIES));

       

      I can externalise my system (application) properties to a file in the JBoss Data directory using the system property.

        private static final String SYSTEM_PROPERTIES = "xxxsystem.properties";

        final String systemPropertiesFilePathAsString = System.getProperty("jboss.server.data.dir") + File.separator + SYSTEM_PROPERTIES;

        final File systemPropertiesFile = new File(this.systemPropertiesFilePathAsString);

        private Properties systemProperties = new Properties();

        systemProperties.load(new FileReader(this.systemPropertiesFile)

       

      I am keen to externalise a bit of persistence.xml and wondered whats hte voodoo to indirect the value?

       

         <property name="hibernate.hbm2ddl.auto" value="validate" />

       

      e.g.

        

         <property name="hibernate.hbm2ddl.auto" value="$(xxx)" />  [Note: Seam allowed el in the code which was kinda useful for cruff like this]

       

      NOTE:

      I don't use Build scripts (cus I use exploded deployment) so can't use Ant/etc. to substitite at build time as I don't have a "build" step (and dont want to introduce one as it slows delvelopment down too much).

       

      Thx.