[jboss-user] [EJB 3.0] - Re: How to inject data source in AS independent way?
jaikiran
do-not-reply at jboss.com
Mon May 11 09:28:32 EDT 2009
You could use the resource-ref entry:
ejb-jar.xml:
<enterprise-beans>
|
| <session>
| <ejb-name>ABC</ejb-name>
| ...
| <resource-ref>
| <res-ref-name>myDataSource</res-ref-name>
| <res-type>javax.sql.DataSource</res-type>
| </resource-ref>
| ...
| </session>
| ...
|
| ...
|
jboss.xml (for other servers, they would have their own deployment descriptor):
| <enterprise-beans>
|
| <session>
| <ejb-name>ABC</ejb-name>
| ...
| <resource-ref>
| <res-ref-name>myDataSource</res-ref-name>
| <jndi-name>java:DefaultDS</jndi-name>
| </resource-ref>
| ...
| </session>
| ...
|
EJB code:
@Resource (name="myDataSource")
| private DataSource myDS;
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4230057#4230057
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4230057
More information about the jboss-user
mailing list