Is it possible to define resource references that are applicable to all EJBs in an application?
Currently I have an ejb-jar.xml that looks something like this:
<ejb-jar>
<enterprise-beans>
<session id="foo">
<!-- snip -->
<resource-ref>
<res-ref-name>jdbc/myDatasource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</session>
<session id="bar">
<!-- snip -->
<resource-ref>
<res-ref-name>jdbc/myDatasource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</session>
</enterprise-beans>
</ejb-jar>
You'll notice that both EJBs have the same resource-ref defined for both of them. Is there a way to factor this duplication out within a J2EE 1.4 application?
Ideally I should be able to define the jdbc/myDatasource resource once within the application and have anything running inside that container be able to access it by doing a JNDI lookup for "java:comp/env/jdbc/myDatasource". Is there any way to accomplish this?