6 Replies Latest reply on Dec 20, 2012 2:10 PM by Tony Herstell

    Externalising bits of persistence.xml

    Tony Herstell Master

      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();



      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" />




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



      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).