Which code, inserted at Line 15, portably looks up the injected resource?

Given the following code in an EJB 3.0 session bean:
10. @Resource(name=”jdbc/employeeDB”)
11. private DataSource dataSource;
12.
13. public void lookupEmployee(String id) {
14. InitialContext ic = new InitialContextO;
15. // insert code here
16. DataSource ds = (DataSource) obj;
17.}
Which code, inserted at Line 15, portably looks up the injected resource?

Given the following code in an EJB 3.0 session bean:
10. @Resource(name=”jdbc/employeeDB”)
11. private DataSource dataSource;
12.
13. public void lookupEmployee(String id) {
14. InitialContext ic = new InitialContextO;
15. // insert code here
16. DataSource ds = (DataSource) obj;
17.}
Which code, inserted at Line 15, portably looks up the injected resource?

A.
Object obj = ic.lookup(“employeeDB”);

B.
Object obj = ic.lookup(“dataSource”);

C.
Object obj = ic.lookup(“jdbc/employeeDB”);

D.
Object obj = ic.lookup(“javacomp/env/employeeDB”);

E.
Object obj = ic.lookup(“java:comp/env/jdbc/employeeDB”);



Leave a Reply 0

Your email address will not be published. Required fields are marked *