title: How to support multiple configurations in persistence.xml?
body: <p>I am developing a pure Java app with Hibernate in JPA mode. The file persistence.xml contains a single persistence unit which:</p>
  
  <ul>
  <li>contains access credentials to the database</li>
  <li>lists all used entites using class tags</li>
  <li>defines other options such as auto-creation of the schema on every start of the application</li>
  </ul>
  
  <p>Now we are releasing the application and I want to have a configuration for: testing mode, development mode and production mode. They would obviously have different database access credentials and auto-update option.</p>
  
  <p>The only possibilities I can think of have only drawbacks to me:</p>
  
  <ol>
  <li>Have multiple persistence.xml? Bad idea because the entity classes are declared inside the persistence unit. I would have to maintain them in three persistence.xml files</li>
  <li>Have multiple persistence units in one persistence.xml? Also bad idea because I'd have to copy all entity class tags to each of them.</li>
  </ol>
  
  <p>How can I do this? </p>