Are you a Java programmer? And are you looking for a job? If yes, then a further training in Enterprise Java Bean (EJB) can help you to have better prospects in the job market. Go ahead and browse the wisdomjobs page to get all the details of various jobs related to the EJB. If you have good understanding of technologies like Database Servers and Application Servers, then EJB will help you to work on J2EE, based on Application Servers like JBOSS and Web Logic. Wisdomjobs provides you all the information about the skills required, training courses available, job application process details and also prepares you for the job interview. Our technical experts have collected a few EJB(Enterprise JavaBeans) job interview questions and answers that can prepare you for the big interview. Read these questions and crack the interview easily and quickly.
EJB is a specification for J2EE server, not a product.
Java beans may be a graphical component in IDE.
EJB technology is the core of J2EE. It enables developers to write reusable and portable server-side business logic for the J2EE platform.
1.It manages the execution of enterprise beans for J2EE applications.
2.Enterprise beans and their container run on the J2EE server.
The process by which the contents in the memory of one physical m/c are replicated in all the m/c in the cluster is called in-memory replication.
The process of propagating the changes in the properties of a server group during runtime to all the associated clones is called Ripple Effect.
The copies of a server group are called Clones. But unlike a Server Group Clones are associated with a node and are real server process running in that node.
There are two types of scaling: Vertical Scaling and Horizontal Scaling.
Vertical Scaling - When multiple server clones of an application server are defined on the same physical m/c, it is called Vertical Scaling. The objective is to use the processing power of that m/c more efficiently.
Horizontal Scaling - When Clones of an application server are defined on multiple physical m/c, it is called Horizontal Scaling. The objective is to use more than one less powerful m/c more efficiently.
A server group is a template of an Application Server(and its contents) i.e, it is a logical representation of the application server. It has the same structure and attributes as the real Application Server, but it is not associated with any node, and does not correspond to any real server process running on any node.
It must be abstract class. The container extends it and implements methods which are required for managing the relationships
Following are some of the main features supported in EJB 2.0:
1. Integration of EJB with JMS.
2. Message Driven Beans.
3. Implement additional Business methods in Home interface which are not specific for bean instance, EJB QL.
We can use the Java 2 Platform, Enterprise Edition Client Access Services (J2EETM CAS) COM Bridge 1.0, currently downloadable from Sun
Entity beans that have container-managed relationships with other entity beans, must be accessed in the same local scope as those related beans, and therefore typically provide a local client view. In order to be the target of a container-managed relationship, an entity bean with container-managed persistence must provide a local interface.
EJBDoclet is an open source JavaDoc doclet that generates a lot of the EJB related source files from custom JavaDoc comments tags embedded in the EJB source file.
An entity bean represents persistent global data from the database; a session bean represents transient user-specific data that will die when the user disconnects (ends his session). Generally, the session beans implement business methods (e.g. Bank.transferFunds) that call entity beans (e.g. Account.deposit, Account.withdraw)
Although technically it is legal, static initializer blocks are used to execute some piece of code before executing any constructor or method while instantiating a class. Static initializer blocks are also typically used to initialize static fields - which may be illegal in EJB if they are read/write - In EJB this can be achieved by including the code in either the ejbCreate(), setSessionContext() or setEntityContext() methods
1. Transaction_read_uncommitted- Allows a method to read uncommitted data from a DB(fast but not wise).
2. Transaction_read_committed- Guarantees that the data you are getting has been committed.
3. Transaction_repeatable_read - Guarantees that all reads of the database will be the same during the transaction (good for read and update operations).
4. Transaction_serializable- All the transactions for resource are performed serial.
Yes. In some cases the data is inserted NOT using Java application, so you may only need to retrieve the information, perform its processing, but not create your own information of this kind.
Session and Entity EJBs consist of 4 and 5 parts respetively:
1. A remote interface (a client interacts with it).
2. A home interface (used for creating objects and for declaring business methods).
3. A bean object (an object, which actually performs business logic and EJB-specific operations).
4. A deployment descriptor (an XML file containing all information required for maintaining the EJB) or a set of deployment descriptors (if you are using some container-specific features).
5.A Primary Key class - is only Entity bean specific.
1.EJB QL is a Query Language provided for navigation across a network of enterprise beans and dependent objects defined by means of container managed persistence.
2.EJB QL is introduced in the EJB 2.0 specification.
3.The EJB QL query language defines finder methods for entity beans with container managed persistence and is portable across containers and persistence managers.
4.EJB QL is used for queries of two types of finder methods:
Finder methods that are defined in the home interface of an entity bean and which return entity objects.Select methods, which are not exposed to the client, but which are used by the Bean Provider to select persistent values that are maintained by the Persistence Manager or to select entity objects that are related to the entity bean on which the query is defined.
1: Retrieve Home Object reference from Naming Service via JNDI.
2: Return Home Object reference to the client.
3: Create me a new EJB Object through Home Object interface.
4: Create EJB Object from the Ejb Object
5: Return EJB Object reference to the client.
6: Invoke business method using EJB Object reference.
7: Delegate request to Bean (Enterprise Bean).
Callback methods allows the container to notify the bean of events in its life cycle. The callback methods are defined in the javax.ejb.EntityBean interface.
1.An MDB is essentially a message consumer that can listen to a message destination or a message endpoint and gets activated when a message arrives.
2.By design, MDBs are anonymous in nature and hence cannot be directly invoked by a client.
3.The only way to invoke an MDB is to send a message to the destination or endpoint to which it is listening.
4. As MDBs are stateless in nature and are not related to any specific client, they can be pooled for concurrent processing of messages.
Container services are totally depends upon the “vendor implementation”. But more or less most of the vendors suppots the basic services like,
LifeCycle Management - It is Automatic.
Session Management - it is used by Developer coded callback methods…
Transaction Management - it is used by configuring deployment descriptor (DD) .
Security management - it is used by configuring deployment descriptor (DD) .
The other services, if any will be in advanced versions, and depends on Vendor specific.
Deployment descriptor is a XML file. which is used to locate the web applicatio n by container.it includes the details of respective bean.
For a Session bean - one EJB object for one bean instance.
For entity bean - it depends , if 2 users are accessing one row at time then one EJB object is used for both the beans other wise for each bean one EJB object.
If we define the entity bean as being reentrant, multiple clients can connect to the Entity bean & execute methods within the entity bean concurrently. Container takes care of synchronization. If we define the entity bean as non-reentrant and many clients connect to it concurrently to execute a method, exception is thrown .
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 beans 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.
An EJB container is a run-time environment that manages one or more enterprise beans. The EJB container manages the life cycles of enterprise bean objects, coordinates distributed transactions, and implements object security. Generally, each EJB container is provided by an EJB server and contains a set of enterprise beans that run on the server.
1.The remote client view specification is only available in EJB 2.0.
2. The remote client view of an enterprise bean is location independent.
3.A client running in the same JVM as a bean instance uses the same API to access the bean as a client running in a different JVM on the same or different machine.
Remote interface: The remote interface specifies the remote business methods that a client can call on an enterprise bean.
Remote home interface: The remote home interface specifies the methods used by remote clients for locating, creating, and removing instances of enterprise bean classes.
1.The local client view specification is only available in EJB 2.0. Unlike the remote client view, the local client view of a bean is location dependent.
2.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.
3.The local client view therefore does not provide the location transparency provided by the remote client view. Local interfaces and local home interfaces provide support for lightweight access from enterprise bean that are local clients.
4.Session and entity beans can be tightly couple with their clients, allowing access without the overhead typically associated with remote method calls.
EJB(Enterprise JavaBeans) Related Tutorials
|J2EE Tutorial||Core Java Tutorial|
|JDBC Tutorial||JSP Tutorial|
|Android Tutorial||JavaServer Faces (JSF) Tutorial|
|Java 8 Tutorial||JAVA Persistence API (JPA) Tutorial|
EJB(Enterprise JavaBeans) Related Interview Questions
|J2EE Interview Questions||Core Java Interview Questions|
|JDBC Interview Questions||JSP Interview Questions|
|Android Interview Questions||JMS(Java Message Service) Interview Questions|
|JavaServer Faces (JSF) Interview Questions||Java collections framework Interview Questions|
|Java 8 Interview Questions||Java Collections Interview Questions|
|Java Exception Handling Interview Questions||Java Concurrency Interview Questions|
|Java Serialization Interview Questions||Java Programmer Interview Questions|
|Java Inheritance Interview Questions||Java IO Interview Questions|
|Object Oriented Programming in PHP Interview Questions|
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.