File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "global parameter for EJBs" Watch "global parameter for EJBs" New topic

global parameter for EJBs

Yan Zhou
Ranch Hand

Joined: Sep 02, 2003
Posts: 137

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.

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32844

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.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Saulius Sinkunas

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:

I agree. Here's the link:
subject: global parameter for EJBs
jQuery in Action, 3rd edition