Which statement describes how to manage the data correctly?

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 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.



Leave a Reply 5

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


Ramy

Ramy

I think B
Why E ?
Why at @PostConstruct ?
He should do the JNDI lookup at any business method

Japs

Japs

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

John

John

correct is B. A stateless session bean cannot access resource managers in a @PostConstruct method.