Top 50 ejb Interview Questions You Must Prepare 02.Mar.2024

During compilation, the values of each case of a switch statement must evaluate to a value that can be promoted to an int value.

WHERE and ORDERBY clauses are optional in EJB QL where as SELECT and FROM are required clauses.

The finally clause of the try-catch-finally statement is always executed unless the thread of execution terminates or an exception occurs within the execution of the finally clause.

A protected method may only be accessed by classes or interfaces of the same package or by subclasses of the class in which it is declared.

Session be are used to shield the client from the complexity of the business logic. They provide access to special trient business services. They are created by the client submitting the query to the database and exist as long as the client server session exists.

Session bean components implement the javax.ejb.SessionBean interface. Client invokes the methods on the session be to access the application in the server.

  • Security support: Used to configure Deployment Descriptor (DD).
  • Persistence support: Used to be persistence in tractions.
  • Traction management support: Used to configure Deployment Descriptor (DD).
  • Management of Session: Callback methods such as ejbStore (), ejbLoad () are used in the Developer.
  • Management of Life Cycle: Automatic

A component can handle its own events by implementing the required event-listener interface and adding itself as its own event listener.

Java is an object-oriented programming language developed initially by James Gosling and colleagues at Sun Microsystems. The language, initially called Oak (named after the oak trees outside Gosling's office), was intended to replace C++, although the feature set better resembles that of Objective C. Java should not be confused with JavaScript, which shares only the name and a similar C-like syntax. Sun Microsystems currently maintains and updates Java regularly.

The JDK 1.02 event model uses an event inheritance or bubbling approach. In this model, components are required to handle their own events. If they do not handle a particular event, the event is inherited by (or bubbled up to) the component's container. The container then either handles the event or it is bubbled up to its container and so on, until the highest-level container has been tried. In the event-delegation model, specific objects are designated as event handlers for GUI components. These objects implement event-listener interfaces. The event-delegation model is more efficient than the event-inheritance model because it eliminates the processing required to support the bubbling of unhandled events.

The Collection interface provides support for the implementation of a mathematical bag - an unordered collection of objects that may contain duplicates.

A Choice is displayed in a compact form that requires you to pull it down to see the list of available choices. Only one item may be selected from a Choice. A List may be displayed in such a way that several List items are visible. A List supports the selection of one or more List items.

So they can be invoked as if they are a mathematical code library.

An I/O filter is an object that reads from one stream and writes to another, usually altering the data in some way as it is passed from one stream to another.


The local client view specification is only available in EJB 2.@Unlike the remote client view, the local client view of a bean is location dependent. Local client view access to an enterprise bean requires both the local client and the enterprise bean that provides the local client view to be in the same JVM. The local client view therefore does not provide the location trparency provided by the remote client view. Local interfaces and local home interfaces provide support for lightweight access from enterprise bean that are local clients. Session and entity be can be tightly couple with their clients, allowing access without the overhead typically associated with remote method calls.

The File class is used to create objects that provide access to the files and directories of a local file system.

The left operand is an object reference or null value and the right operand is a class, interface, or array type.

You shouldn’t. What will happen depends on the implementation, but the call will most likely be ignored.

Java uses layout managers to lay out components in a consistent manner across all windowing platforms. Since Java's layout managers aren't tied to absolute sizing and positioning, they are able to accommodate platform-specific differences among windowing systems.


A local inner class may be final or abstract.


The java.util.EventObject class is the highest-level class in the event-delegation class hierarchy.


A static variable is associated with the class as a whole rather than with specific instances of a class. Non-static variables take on unique values with each object instance.

A while statement checks at the beginning of a loop to see whether the next loop iteration should occur. A do statement checks at the end of a loop to see whether the next iteration of a loop should occur. The do statement will always execute the body of a loop at least once.

An EJB server is a high-level process or application that provides a run-time environment to support the execution of server applications that use enterprise be. An EJB server provides a JNDI-accessible naming service, manages and coordinates the allocation of resources to client applications, provides access to system resources, and provides a traction service. An EJB server could be provided by, for example, a database or application server.

The abs() method is used to calculate absolute values.


An EJB client JAR file is an optional JAR file that can contain all the class files that a client program needs to use the client view of the enterprise be that are contained in the EJB JAR file. If you decide not to create a client JAR file for an EJB module, all of the client interface classes will be in the EJB JAR file.

The ObjectInputStream class supports the reading of objects from input streams.

Since EnterpriseBe live in a managed container, the container is free to call  your EJB components methods at its leisure. The container houses the information like current status of bean,security credentials of the user currently accessing the bean in one object is called EJBContext Object. A context represents a way for be to perform callbacks and modify their current status Sessioncontext is EJB context for session bean Entitycontext is EJB context for entity bean Message driven context is EJB context for message driven bean

The elements of a GridBad layout are of equal size and are laid out using the squares of a grid.

Modules are packaged based on their functionality as EAR, JAR and WAR files.

  • JAR files (.jar) : Modules which contain EJB class files and EJB deployment descriptor are packed as JAR files.
  • WAR Files (.war) : Web modules which contain Servlet class files, JSP Files, supporting files, GIF and HTML files are packaged as JAR file.
  • EAR Files (.ear) : ‘.jar’ & ‘.war’ files are packaged as JAR files. ‘Ear’ stands for enterprise archive. These files are deployed in the application server.

Between the client and the session bean, the state of the conversation can be maintained using a stateful session bean. The instance variables contain a state only during the invocation by a client method.

It implements ‘javax.ejb.SessionBean’ interface and is deployed with the declarative attribute ‘stateful’.

They have instance fields that can be initialized and modified by the client with each method invocation. The bean can use the conversational states as its business process methods.

They are:


EJB was developed by IBM in 1997.

The non-Unicode letter characters $ and _ may appear as the first character of an identifier

No. Decorator design pattern, is the one which exhibits very low level runtime polymorphism, for the specific and single object (Instance of the class), but not for atleast for a class. It is the stuff to add specific functionality to a single & pointed object and leaves others like it unmodified. It is having close similarities like aspectJ stuff, but not with EJB stuff.

By associating Checkbox objects with a CheckboxGroup.

They are:

  • Session Be: Expanded as “Stateful”,”Stateless” and “Singleton”, A Remote or Local interface is used to access the EJB files.
  • Message Driven Be (MDB): Asynchronous execution by me of messaging paradigm is supported.

Containers which uses Border Layout as their default are: window, Frame and Dialog classes.

The compiler supplies a default constructor for a class if no other constructors are provided.

A well-written OO program exhibits recurring structures that promote abstraction, flexibility, modularity and elegance.

This() is used to invoke a constructor of the same class. super() is used to invoke a superclass constructor.

An EJB container is a run-time environment that manages one or more enterprise be. The EJB container manages the life cycles of enterprise bean objects, coordinates distributed tractions, and implements object security. Generally, each EJB container is provided by an EJB server and contains a set of enterprise be that run on the server.

When a task's interrupt() method is executed, the task enters the ready state. The next time the task enters the running state, an InterruptedException is thrown.


This is a method of binding a name to a specific object by giving an interface like javax.naming.Context

The class System has a variable out that represents the standard output, and the variable err that represents the standard error device. By default, they both point at the system console. This how the standard output could be re-directed: 
Stream st = new Stream(new FileOutputStream("output.txt")); System.setErr(st); System.setOut(st);


A field variable is a variable that is declared as a member of a class. A local variable is a variable that is declared local to a method.

EJBContext is an interface implemented by the container. It is a part of the bean-container contract.

  • EntityContext: This is a sub-class of EJBContext that Entity be use.
  • SessionContext: Session be use this subclass.

These EJBContext objects provide the bean class with information about its:

  • Container.
  • Client using the bean.
  • Bean itself.

Yes, all functions in Java are virtual by default. This is actually a pseudo trick question because the word "virtual" is not part of the naming convention in Java (as it is in C++, C-sharp and VB.NET), so this would be a foreign concept for someone who has only coded in Java. Virtual functions or virtual methods are functions or methods that will be redefined in derived classes.

EJB was taken over by Sun Microsystems in 1999.

The operating system's task scheduler allocates execution time to multiple tasks. By quickly switching between executing tasks, it creates the impression that tasks execute sequentially.

Heavy weight application consume a lot of time while loading the plug-ins. In lazy loading approach, the plug-ins that are needed at that particular time are loaded and instantiated. This boosts up the performance as only the plug-ins that are used are loaded. This also ensures the efficiency and speeds up the initial load time of the applications. Applications like Eclipse use this approach. In other words, the goal of lazy loading is to dedicate memory only when it is absolutely necessary.