In the project i work, each company has your own database, but the
login system is the same to all. When a company logs in the system,
the system looks for the database for the company in a specific
table in a database x. After all, everything the company do in the
system, will be done in you own database.

The problem is the following:

I use 1 entity for each table to all companies. i don�t know how to
say to an entity bean to use a specific a data source for each company
that login in the system. Today, a do the following:

myentity.findByContactType(contactTypeId, dataBase)


public ejbFindByContactType {String contactTypeId, String dataBase) {
       .
       .
       .
       javax.sql.DataSource test = 
(javax.sql.DataSource)ctx.lookup("java:comp/env/jdbc/base"+dataBase+"priv");
       .
       .
       .
}

It�s terrible, no?


I�d like to receive suggestions of how can i do that without having to
get the dataBase number by a parameter in a find or create method...


Thanks for all,


Wagner Soares Nobres
[EMAIL PROTECTED]

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