...
Code Block | ||||
---|---|---|---|---|
| ||||
@Resource(name="myDerbyDatabase", type="javax.sql.DataSource".class) @Stateless public class FooBean { public void setSessionContext(SessionContext sessionContext) { DataSource dataSource = (DataSource) sessionContext.lookup("myDerbyDatabase"); } public void someOtherMethod() throws Exception { InitialContext initialContext = new InitialContext(); DataSource dataSource = (DataSource) initialContext.lookup("java:comp/env/myDerbyDatabase"); } } |
...