I have a scenario where, depending upon the server where my application is running, I need to change the settings to persistance.xml.
For eg. if its running on Server A, then it should use different database(different url), different password etc. and if the application is running on Server B then it should use different information.
And could you also tell me, which way should it be done, using datasource or simply putting properties under persistence-unit.
Usually you have multiple persistence.xml files and when you run your build you run a target for each environment. Or each developer edits their own local version of persistence.xml to match what they need. But the Integration building team changes theirs for their environment.