I'm currently deal with web applications calling stateless Session Beans in order to interact with a database. My question is about how such application can call the same session bean in a way that the latter can choose which entity manager must use to access the database.
At present time I managed this situation launching different Jboss instances, listening on different ports, and in each instance I've deployed the same Session Bean pool and one or more web application have to deal with the same database. In other words, every Jboss instance contains a certain number of web application, a persistence unit (persistence.xml in META-INF jar containing the @Entity's)
and the pool of session bean all inside an ear.
It's self evident where the main weakness reside on: as more different database I need to deal with, as much Jboss instance I must mantain, and it's not sustainable mainly, but not only, for resources reason.
My final question is: what's the best practice to deploy different web application calling session beans that differ only for the EntityManager injected in them?
Thanks in advance
Stfn