EJB's past and present life
The advent of the Enterprise Java Beans (EJB) is a technology that Sun prides itself on as a server-side component Architecture model on the Java Enterprise Edition (abbreviated Java EE) platform, originally designed for the ministry Department distributed applications.
Prior to EJB, the 1991 OMG had proposed CORBA 1.1, defined the IDL interface definition language and developed object request Proxy ORB middleware, and completed CORBA 2.0 in December in 1994, hoping to pass IIOP (Internet Inter Object Protocol) to standardize and guide the communication between the ORB of different manufacturers, and add the corresponding API to implement the program implementation on different platforms in different languages such as Java, C + + and SmallTalk.
When Java was born, the great Sun Microsystems also wrote the Java Servlet specification for running Java programs written by a program on a Web server, a Servlet that can produce dynamic content through manageable Web Components and add onto a Web server to Request-response with a Web client, which serves as a middle-tier component for contacting front-end Web requests and back-end data, so that we have a three-tier architecture of the Web.
This three-tier architecture extends the server, data middleware, and client presentation layers from the server side to avoid code bloat and redundancy on the FAT client and server. At this time, the appearance of JavaBeans became a ripe. JavaBeans takes the concept of components into Java object-oriented programming and makes software reuse easier. It provides a simple and convenient design method, Java programs that run on the client or server side are encoded by visual builders, and design patterns are used to encode conventions for methods and interfaces; Java classes also show variables, methods, and events through the persistence of JavaBeans, Maintain the state after it has been customized.
By April 1997, Sun had launched a technology innovation that changed to a great extend to software development, namely Java 2 Platform Enterprise Edition (known as EE), including:
Enterprise JavaBeans (EJB) technology
Java Interface Definition Language (IDL)
Java message Service (JMS) API
Java Naming and Directory Interface (JNDI)
Java Remote method Invocation (RMI) and Object serialization
Java Servlet API
Java Transaction API (JTA)
Java Transaction Service (JTS)
JavaServer Pages (JSP) technology
JDBC Database Access API
In the specification of EJB 1.0, the correlation between components and Java naming and Directory Interface (JNDI), and the Java Transaction API (JTA) in programming to start and stop transactions, is made clear Really explain and explain, want to truly achieve write Once,run anywhere programmer dream.
The EJB then came from 1.0, enhanced interoperability with non-Java applications, and a session bean for implementing business logic, which was used to map data from the database to an entity Bean (Entity Bean) in an in-memory entity object, and the EJB2 The message-driven bean (Messagedriven bean) introduced in. 0. The Messagedriven Bean is an asynchronous stateless session bean that is used as a JMS message to receive and process JMS data sent by the client. This completes the client's asynchronous processing request when the client invokes the Messagedriven Bean without waiting to return to the program. In fact, for the session Bean itself, it can be stateless or stateful. When a client has a request, the Java container selects a session Bean for servicing. The Entity bean, which is the domain model object, synchronizes the entity Bean State with the database to ensure the unity and integrity of the database and the entity objects in memory.
In Dialectics, everything has a second face, and EJB is no exception. With the impact of lightweight frameworks such as Spring and Hibernate, EJB 2.0 has been abandoned by many programmers for its complexity. To find a balance between ease-of-use and development complexity, EJB 3.0 presents a number of important changes that help programmers mitigate the workload and complexity of low-level development.
EJB 3.0 has joined the Hibernate O/R mapping model, from the original abstract-persistence-schema-based into the current hibernate-inspired mode. And in the EJB QL support HQL (belongs to Hibernate own database query language), thus facilitates the programmer to process the data query and the update, the connection pool, the transaction processing, the entity relations and so on more convenient.
The EJB 3.0 specification adds a set of annotated EJB programming models that can be used to define the business interface, O/R mapping information, and resource reference information for the EJB. For stateless session beans, programmers do not have to develop deployment descriptors and home interfaces, and do not implement the appropriate business interface, just a simple Java file and add @Stateless annotations to the class layer, and the container will help the programmer to complete it. Only the message-driven bean (Messagedriven bean) is a bean that must implement a business interface. The programmer needs to use this interface to indicate which message system the bean is supporting. For example, for message-driven beans based on JMS, this interface is Javax.jms.MessageListener.
With the introduction of EJB3.1, we find that from code development to system deployment, EJB3.1 makes enterprise-class Java development easier. Let's take a look at some of the most important changes in EJB 3.1:
Global Jndi names (Unified global Jndi naming)
Session Beans Asynchronous Invocation (asynchronous session bean invocation)
No-interface view (no interface views)
Timer-service (Dispatch service)
Lightweight EJB (EJB Lite)
embeddable EJB Containers (embedded EJB container)