• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

global parameter for EJBs

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author & internet detective
Posts: 41967
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:

 
My cellmate was this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic