users@glassfish.java.net

How to inject data source in AS independent way?

From: <glassfish_at_javadesktop.org>
Date: Mon, 11 May 2009 03:43:32 PDT

Hi,

Our application uses a number of data sources. In all examples we have found data source injection in an EJB is done with the @Resource annotation and the ‘mappedName’ attribute, e.g.:

@Resource(mappedName="jdbc/fndbas_en-US")
private DataSource dsEn;


But the problem is that the ‘mappedName’ attribute is application server specific. For example the data source from example above in JBoss has to be prefixed with “java”, i.e.: "java:jdbc/fndbas_en-US".

Is there any way to inject data sources in a way that isn’t application server specific?

Thanks!
[Message sent by forum member 'japase' (japase)]

http://forums.java.net/jive/thread.jspa?messageID=345766