문제

This is how they declare a resource-ref in ejb-jar.xml :

<enterprise-beans>
<session>
<ejb-name>ResourceBean</ejb-name>
<resource-ref>
<res-ref-name>jdbc/employee</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
</resource-ref>
</session>
</enterprise-beans>

at this link: http://javahowto.blogspot.ca/2006/06/5-ways-to-get-resources-in-ejb-3.html Now if I have another session bean that needs to use the same resource-ref, do I have to declare it again inside the second EJB? Or is there a workaround?

도움이 되었습니까?

해결책

Prior to EE 6 (available in WebSphere Application Server 8.0), there is no way to share resource-ref across EJBs. You must redeclare the resource-ref in each EJB.

In EE 6, you can declare the resource-ref with a name such as java:module/env/jdbc/employee, and it will be visible to all EJBs in the module (and java:app is visible to all modules, and java:global is visible to all apps).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top