There are 2 ways of using a persistence unit, code or annotation.
CODE
[..]
EntityManagerFactory emf;
emf = Persistence.createEntityManagerFactory("SOMEPU");
[..]
or
ANNOTATION
[..]
@PersistenceContext(name = "persistence/LogicalName", unitName = "SOMEPU")
[..]
Question: If you want to change the persistence unit (or point to different jdbc source), I could easily adapt the sourcecode version to read a variable from some settings file or whatever. But I cant put variables into annotations. Whats is the solution ?
Yes, I could keep always the same PU and just point the jbdc resource in the applicationserver to somewhere else, but I dont want anyone to tinker around in the admin settings of the AS.
cheers Sven