Which of the following can be directly invoked by the client?

- ejbPassivate
- business methods
- setSessionContext
- newInstance

CORRECT ANSWER : business methods

Discussion Board
Business methods

Business Methods are invoked by clients on the object reference which it gets from dependency injection or JNDI lookup. The purpose of a session bean is to run business tasks or methods for the client. The business methods run locally as per the client's perspective but in reality they run remotely in the session bean. The business rule must adhere to the following rules:

1) No method name can begin with ejb this is to avoid conflicts with callback methods defined by the EJB architecture.

It is not allowed to call a business method like this: ejbCreate or ejbActivate.

2) The access control modifier must be public. The argument and return types must be legal for the JRMI API if bean allows any remote access through remote business interface.

3) The modifier must not be static or final. The throws method can include exceptions that can be defined by the application for example: remove method if something is not present then an Exception is thrown.

Rohit Sharma 08-19-2014 07:04 PM

Write your comments


Enter the code shown above:
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)