Hello everyone,

I have some CMP entity beans which can get data from any of 15-20 database
servers. The data on these servers is most of the time mutually exclusive
i.e. we have employed horizontal partitioning.

Now, the problem is that when a user sends a request, the request also
contains the database server to get the data from. Using BMP or custom JDBC
code, this problem is trivial. I'm having hard time figuring out how to do
this with CMP beans.

I did some research and saw some posting about changing the datasource. I
tried it with Orion and it doesn't work. Even if it did work, I still have
some concerns:
1. How long the datasource should remain changed i.e. if I change it just
before instantiating one bean and change it back again, then what happens if
I have to instantiate some other beans for the same client?
2. The server could be handling multiple concurrent requests from different
users. What happens if I change the datasource while servicing request for
one user and before the bean could be instantiated, the second user changes
the datasource to something else?
3. What is the responsibility of the container as far as keeping the
datasource object? Does the container maintain a datasource object for each
Home handle? Is a Home handle is unique for each client/session?
4. Similarly, is the java:comp/env/... maintained for each client or each
bean type?

I have tried the brute force method of registering the same beans under
different contexts and associating beans to different datasources under each
context. This works... The issues with this approach are:
1. Maintainability as servers are added/removed
2. Overhead in the run-time environment

I'll appreciate any help in solving this issue other than the brute force
method just mentioned. Does EJB 2.0 address this issue?

Thanks,
Deepak Goel
Siemens IC

===========================================================================
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".

Reply via email to