Portable datasource jndi for JBoss and OC4j

133 views Asked by At

I am new to JBoss development, I am migrating one application from OC4J to JBoss, What i came to know is jndi names are different in OC4J and JBoss Application Server, So i have one jndi datasource named as jdbc/sampleDataSource in OC4J datasource configuration. Similarly I have done a configuration for JBoss named as java:/jdbc/sampleDataSource.

As the ear should be able to deploy on both application server, I am facing issues while making code compatible for JBoss as well OC4j

For e.g 
   @Resource(mappedName = "jdbc/sampleDataSource")
   private sampleDataSource dataSource;

How can i make above parameter compatible for JBoss as well OC4J as the jndi name is different in both Server?

There are also bean level data source injection:

@Resource( name = "jdbc/sampleDataSource", type = javax.sql.DataSource.class, mappedName = "jdbc/sampleDataSource", authenticationType = Resource.AuthenticationType.CONTAINER),

So please let me know what are the changes i need to perform to make the code compatible with JBoss AS7 and OC4J as well.

0

There are 0 answers