This is the only way that I know of doing this in EJB. There are some negative implications with this:
1. You really have to deploy another bean with a different JNDI name for each datasource 2. Your code, in your client application will have to resolve/use different EJB beans. 3. If you are using Container Managed Relationships, they would have to be re-stated for each bean you deploy a. Any bean which relates to this bean, would have to have different relationships specified b. If you relating from this bean to other beans, you will need to restate relationships for each bean deployed with a different data source
If you are using BMP, then you could encode the datasource in the key. Then using the key, you can get the proper resource and read from the right database. Implementing finders, however, would be interesting, since you would need to query all the datasources. This might be what you want, or not.
In general, I don't believe there is a nice way to deal with this issue in J2EE.
Perhaps you could re-think this requirement and find a different method of implementing this task.
Good luck.
-- -AP_ http://www.myprofiles.com/member/profile/apara_personal http://www.myprofiles.com/member/profile/apara_business
Vikram Naik wrote:
Hello People,
We have a requirement for deploying same ejb multiple times with different datasources. I think we can achieve this by deploying the same bean with different datasources with different JNDI names. Please suggest your views or implications for doing so .
Regards, Vikram Naik =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".