i'm trying to write an EJB3 Stateless Session Bean which gets the parameter "customerCode" (String). Dependent on this "customerCode" i want to create an EntityManager (Persistence.createEntityManagerFactory...) with a (dynamically?) created PersistenceUnit.
I can not define the PU in the persistence.xml, because it's name (and underlying datasource) must be able to be added/removed at runtime (e.g. deploying a new datasource/persistence unit that belongs to a specific customer code).
I could define the PUs in the persistence.xml, because i know all the customerCodes in advance, but if the datasource XML file is missing, i can not deploy my EAR correctly, because the container (JBOSS) looks for a matching datasource.
what can i do? thanks in advance!