I have an application where the data source it uses is saved in the database. This is because each user can have its own data source.
So UserA will have an entry in it's user information table that says to use data source jdbc/UserA.
Lets assume that this entry is already configured in the app server itself.
How do I tell the EntityManager at runtime to use that datasource.
If this was a static configuration I know I will have the persistence unit defined in my persistence.xml file and I would set the annotation in my entity. Something like this
@PersistenceContext(unitName="userAunit") private EntityManager em;
Did you find a solution for your problem? I am looking into something like this.