Discussions

EJB design: CMP Entity Bean Accessing Multiple Databases

  1. Hello EJB Gurus,

    Is it possible to dynamically change the database into which data is persisted at run time depending on a criteria for an Entity Bean which uses container managed persistence?

    Or is the best solution for the problem is to deploy the entity bean with different deployment descriptors which point to different databases and deploy it in JNDI in a context ejb/<criteria>/bean. A session bean can do the look up from JNDI for the specific EJB?

    I don't want to use Bean Managed Persistence if there is a choice..

    Thanks in advance for your help..

    Regards,
    Murali
  2. I do this today, simply by changing the deployment descriptor to point to a different data source.

    I am using BEA's Weblogic Server 6.0
  3. Thanks Paul. Do you have different JNDI name for the bean per data source?
  4. Thanks Paul. Do you have different JNDI name for the bean per data source?