title: Insert external data into persistence.xml
body: <p>I want my persistence.xml to set some of its properties dynamically, to be specific:</p>
  
  <pre><code>&lt;property name="hibernate.connection.password" value="password"/&gt;
  &lt;property name="hibernate.connection.username" value="username"/&gt;
  </code></pre>
  
  <p>I can build a class that could provide me the data I need, but I don't know how to set the class up in a way that it works like this:</p>
  
  <pre><code>&lt;property name="hibernate.connection.password" value="${my.clazz.pass}"/&gt;
  &lt;property name="hibernate.connection.username" value="${my.clazz.user}"/&gt;
  </code></pre>
  
  <p>I have tried to set the class up like this</p>
  
  <pre><code>public class clazz{
  
    String pass;
    String user;
  
    public clazz(){
      //do stuff to set pass and user
    }
  
    //getter/setter
  }
  </code></pre>
  
  <p>But that does not work. I haven't found a way here or in google, but I have seen the ${my.clazz.smth}-way several times.</p>
  
  <p>So, how can I set that up? :)</p>
  
  <p>Thanks in advance!</p>