Term
| Which type(s) of bean do clients call? |
|
Definition
| Session beans are the ones that encapsulate the business logic which is why it is the only bean called by clients. MDB and Entity beans are called by the session bean to complete the business requirement. |
|
|
Term
| What is a business interface? |
|
Definition
| An interface through which a client invokes the bean business-logic methods. |
|
|
Term
| What are the different types of business interfaces in EJB3? |
|
Definition
|
|
Term
| Why are JDNI lookups not required in EJB3? |
|
Definition
| Dependency Injection is available, which is actually a wrapper for JNDI lookups. Developer is not required to manually do a JNDI lookup, the container does it automatically. |
|
|
Term
| What kind of client is required to JNDI lookups in EJB3? |
|
Definition
|
|
Term
| What are the criteria for a method to be a lifecycle method in EJB3? What annotations are available? |
|
Definition
Only requirement is one of the four annotations @PostConstruct @PrePassivate @PostActivate @PreDestroy |
|
|
Term
| Is it necessary to define lifecycle methods in the business interface? Can lifecycle methods throw exceptions? |
|
Definition
Not necessary to define in the interface. Should not throw any checked exceptions. |
|
|
Term
| How do you invoke EJB3 from Servlet/JSP? |
|
Definition
| @EJB for injection, or JNDI lookup |
|
|
Term
|
Definition
| Enterprise Java Beans is a standard server side component model for distributed business applications. |
|
|
Term
| What is an interceptor class per EJB3 specification? |
|
Definition
| Class associated with an EJB, and acts as a listener for the lifecycle methods. |
|
|
Term
| How are interceptors annotated in EJB3? |
|
Definition
@AroundInvoke for the interceptor method. @Interceptors(Foo.class) at class level in a bean will use the lifecycle methods in Foo for the lifecycle events of the bean. |
|
|
Term
| How many different ways to define an Interceptor in EJB3? |
|
Definition
| Within the EJB body or in a separate class. |
|
|
Term
| How many ways to configure an interceptor? |
|
Definition
| Class level, Default (.xml), and Method level. |
|
|
Term
| What are the annotations available for DI? |
|
Definition
| @EJB for injection beans, @Resource for container resources (DataSource, Context, JMS, etc) |
|
|
Term
| What standard annotations are used? |
|
Definition
| The most common annotations are @Stateless, @Stateful, @Remote, @Local, @Entity |
|
|
Term
| Is it possible to exclude interceptors? If so, how do you do it? |
|
Definition
| @ExcludeClassInterceptors and @ExcludeDefaultInterceptors |
|
|
Term
| What are the different types of EJBs? |
|
Definition
- Session Beans are extensions of the client application that manage processes or tasks.
- Entity Beans model business concepts that can be expressed as nouns
- Message Driven Beans are integration points for other applications interested in working with the EJB application. Java application or legacy systems that need to access EJB applications can send messages to MDBs via JMS
|
|
|
Term
| What are the advantages of using EJBs? |
|
Definition
EJBs are distributed Objects that may be remotely accessed by a variety of clients.
- Easier to build Business Components
- Provide Reliability, Robustness, and Scalability
- Supported by a rich set of services by the application server
- Implicit Services: Transactions, Security, LifeCycle, Concurrency, Persistance, Remote Access
- Explicit Services: JDBC, JTS, JNDI, JCA, RMI, JMX, JAAS
|
|
|
Term
| What is the difference between a Stateless and a Stateful session bean? |
|
Definition
| Conversational state is maintained in the case of Stateful Session Beans. |
|
|
Term
| What is a Remote interface? |
|
Definition
| It defines the bean's business methods which can be accessed from applications outside the EJB container. |
|
|
Term
| What datatypes can be passed as parameters or returned from EJBs? |
|
Definition
Primitives Serializable Remote |
|
|
Term
| What types of message models are there for MDBs? |
|
Definition
Queue (Point-to-Point) Topic (Publish Subscribe) |
|
|
Term
| How are transactions managed in EJBs? |
|
Definition
|
|
Term
| What are the transaction attributes? |
|
Definition
Not Supported Supports Required Requires_new Mandatory Never |
|
|
Term
| What are the transactional attributes supported by MDBs? |
|
Definition
|
|
Term
| What are the transactional isolation levels? |
|
Definition
Read uncommitted Read committed Repeatable Read Serializable |
|
|