aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes global parameter for EJBs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "global parameter for EJBs" Watch "global parameter for EJBs" New topic
Author

global parameter for EJBs

Yan Zhou
Ranch Hand

Joined: Sep 02, 2003
Posts: 137
Hi,

In the deployment descriptor, where would I store database lookup names (JNDI name) for all EJBs?

I understand that each EJB has a resource-ref entry in DD which it can define resource JNDI name, but if all my EJBs point to the same Database, there ought to be a way globally defining that for ALL ejbs. I just do not know where that is in the DD.

Thanks.
Yan
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30927
    
158

Yan,
As you know, you define the datasource on the server. So the real database info is in one place. As far as I know, you need to define the resource reference repeatedly though. In a way this makes sense because different beans could refer to the same datasource in different ways.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Saulius Sinkunas
Greenhorn

Joined: May 18, 2005
Posts: 20
At first you should declare reference-ref in your DD. You put some logic resource name. For example 'jdbc/SystemDataSource'. When you deploy EJBs into some application server, you must have vendor-specific descriptor file (in JBoss it is 'jboss.xml'), where you must define exactly what 'jdbc/SystemDataSource' means - to what resources it refferers. In jboss.xml you can write it in 'resource-managers' section. For example:

 
 
subject: global parameter for EJBs