Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

global parameter for EJBs

 
Yan Zhou
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34423
347
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Saulius Sinkunas
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic