A developer creates a stateless session bean. This session bean needs data from a remote
system. Reading this data takes a long time. Assume that the data will NOT change during the life
time of the bean and that the information to connect to the remote system is defined in JNDI.
Which statement describes how to manage the data correctly?
A.
Read the data in the bean’s constructor.
B.
The data can only be read in the bean’s business methods.
C.
Read the data in a method which is annotated with @PrePassivate.
D.
Read the data in a method which is annotated with @PostActivate.
E.
Read the data in a method which is annotated with @PostConstruct.
I think B
Why E ?
Why at @PostConstruct ?
He should do the JNDI lookup at any business method
But B said that the data can only read from business method and it’s not true and a method with @PostConstruct is the best place to read the data
correct is B. A stateless session bean cannot access resource managers in a @PostConstruct method.
B
B is correct:
http://www.coderanch.com/t/452462/java-EJB-OCEEJBD/certification/stateless-session-bean-access-resource