This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a J2ee application which is running in JBOSS Server. The Data tier is MySql. We are using CMP Now the scenario is like this, We are having two clients, and the clients have different sub users. The clients are using two seperate database for the same application. Now the application is working in two different servers assigned for each clients. Now we are planning to integrate it to a single application . I would like to know whether 1. Is it possible to specify the JNDI names for more than one database in the deployement descriptor? 2. if it is then, how can we instruct the container to lookup dynamically for the appropriate database based on the user logged in to the application . I am planning to setup a new DB for the users information sothat the container can select the appropriate DB based on the user logged in...
I am facing this problem now and have a solution for this...
same CMP class can be used but deployed with different ejb-name/jndi-name/datasource
so if u have 2 clients to support, the class remains same, but the deployment descriptors deploy the same CMP with 2 different names, 2 diff JNDI.. & they have different datasources... Now in your code, u have the client info, which can be used to lookup the appropriate JNDI name.. (the jndi-name has a prefix of client name, which can be used during lookup..)
If you can write the DD by hand, well & gud.. because none of existing EJB doclet probably support such feature... i wud be writing a doclet for my code soon, as the number of CMPs is 100+ ..
I would like to have more suggestions on same from experts..