What is EJB?

Source: Internet
Author: User
EJB is Sun's server component model. Its greatest use is to deploy distributed applications, similar to Microsoft's. COM technology. With the advantages of cross-platform Java, distributed systems deployed with EJB technology can be not limited to specific platforms.

EJB (Enterprise JavaBean) is a part of J2EE and defines a standard for developing multiple enterprise applications based on components. It features network service support and core development tools (sdks ).

In J2EE, Enterprise Java Beans (ejbs) are called Java Enterprise beans and are the core code of Java, namely Session Bean and Entity Bean) and messagedriven bean ).

1. Session Bean is used to implement business logic. It can be stateful or stateless. Each time a client requests a session bean, the container selects a session bean to serve the client. Session Bean can directly access the database, but in more cases, it will implement data access through Entity Bean.

2. entity Bean is a domain model object used for o/R ing. It maps table records in the database to entity objects in the memory. In fact, creating an Entity Bean object is equivalent to creating a new record, deleting an Entity Bean deletes corresponding records from the database at the same time. When an entity bean is modified, the container automatically synchronizes the status of the Entity Bean with the database.

3. messagedriven Bean is a new enterprise Bean introduced in ejb2.0. Based on JMS messages, it can only receive and process JMS messages sent by clients. MDB is actually an asynchronous stateless Session Bean. After the client calls mdb, it does not need to wait and returns immediately. mdb processes client requests asynchronously. This is suitable for scenarios where requests need to be processed asynchronously, such as order processing. This avoids the client from waiting for a method call for a long time until the returned result is returned.

In fact, EJB is a set of Sun's J2EE specifications and defines a series of APIs to convert the EJB concept into an EJB product. EJB is a bean. What is the concept of beans? There must be a container that can accommodate her and let her make great strides. EJB must exist in the EJB container. this container is extremely powerful! She needs to package your bean first. In fact, the client program of EJB never directly deals with the ejbs you write. they communicate with each other through the home/remote interface. it is responsible for all the food and drinks of your bean, such as bean persistence, security, and transaction management...

1. What is EJB?

One technical specification: EJB is not a "product" technically"
EJB is a standard that describes the solutions to build application components:
Scalable)
Distributed (distributed)
Transactional)
Persistent)
Secure)

Ii. Sun's expectations for EJB

Provides a standard distributed, oo-based component architecture
Shielding complex system-level functional requirements
Write once, run anywhere
Interoperability between non-Java applications
Compatible with the CORBA standard

3. Why select EJB?

The EJB server performs "complicated" tasks: application developers focus on the implementation of business logic rather than the underlying implementation mechanism (similar to the goal of the 4gl language)
Support Transaction Processing
Multiple business operations are successful at the same time, or all of them fail.
You can define the transaction processing level through descriptions outside the code.
Scalability
EJB can be expanded based on your application Growth
The EJB server also provides load balancing and
Security: The EJB server provides resource access control.

Iv. EJB architecture

The Specification describes
Server)
Container)
Class and instance)
Home and remote interfaces
Client)

V. Simplified Programming Model

Focus on business logic implementation: EJB is responsible for lifecycle, persistence, transactional semantic, security ),...
General programming model: High-level APIs of various services
Java is its programming language

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.