Comparison and selection of Java Enterprise Application System framework

Source: Internet
Author: User
Tags aop comparison

The current popular Java Enterprise Application System framework is diverse, in order to enable developers to choose the system architecture to improve the development efficiency of Java Enterprise Application, first of all, based on EJB and the more popular framework based on POJOs, respectively, and then to these frameworks from the presentation layer, The implementation details of the business logic layer and the persistence layer are compared, and the framework selection of Java Enterprise Application system needs to be considered, and the framework based on EJB and the POJOs framework are applied respectively.

Keywords Java enterprise Application System framework; ejb3.0;spring;hibernate

Introduction

EJB Architecture is the foundation and core of Java EE, java-EE defines the application development architecture of the whole standard and a deployment environment, and the EJB based framework has once become the first choice for people to develop the application. With the expansion of the Java Open Source project camp, some open source frameworks based on POJOs (plan old Java Objects) have been increasingly introduced into the development of Java enterprise applications. According to the complexity, people used to call the former a heavyweight framework, which is called the lightweight framework. The Java Enterprise Application framework is generally divided into three levels: the presentation layer, the business logic component layer, and the persistence layer. This paper makes a detailed comparison between the two types of popular frameworks which are applied to these three levels, and finally puts forward the author's view for the system framework of Java Enterprise application.

Overview of two types of frameworks

1, EJB-based heavyweight framework

Because the EJB container can handle system performance, transaction mechanism, security access and distributed operation, the development based on EJB framework can ensure the smooth development of enterprise application, instead of changing a software system to a large scale. It also ensures that developers focus most of their effort on the development of business logic. Enterprise applications developed using EJB frameworks have the characteristics of having to inherit or rely on EJB containers. EJB takes into account the needs of the top-tier large projects and uses it to solve almost all the problems involved in enterprise-class applications, and the corresponding EJB framework is also a heavyweight framework with complex functions.

The EJB 2.1 framework defined by the j2ee1.4 standard lacks design and is somewhat too complex to implement. The goal of EJB 3.0, proposed by the current j2ee5.0 new specification, is to simplify development [1], drawing on some ideas based on Pojo, It is compared with the two important changes in EJB2.1: One is to use the Program annotation tool in Java5, the annotation replaces the excessive XML configuration file and eliminates the strict component model requirement, and the other is the O/R mapping model based on hibernate and TopLink idea.

J2EE5.0 's new specification defines a three-tiered standard for enterprise application: The presentation layer employs JSF (Java Server face), the core of the JSF development process is event driven, the encapsulation of components and tags is very high, and many typical applications do not need developers to process HTTP. The whole process is implemented through the IOC (Dependency injection)[2] ; The business component layer takes the EJB3.0 session Bean. EJB3.0 allows developers to use a loosely coupled component to develop applications. These components are coupled through their own published commercial interfaces, without the strict component model that a bean must adhere to as defined by the EJB 2.1 specification, and each EJB class must inherit from an abstract class and provide a callback hook for the container The persistence layer adopts the EJB3.0 entity bean Persistence model, absorbs some ideas of hibernate and uses the O/R mapping mode, EJBQL also has many important changes.

2. Lightweight framework based on POJOs

Applications developed on the POJOs lightweight framework need not rely on the EJB container to run independently, and the lightweight framework technology that corresponds to the three levels of Java enterprise Applications has been developed in a certain fashion, with the following three-tiered frameworks:

At present, the more popular open source performance layer framework is mainly struts and tapestry. Unlike the Struts application framework, tapestry is based on components rather than scripting languages such as JSP and velocity, and components are composed of a definition file (in XML format), an HTML template, and a Java class There are also a number of business component layer lightweight solutions, including spring, Hivemind, and so on. But the most widely used is the spring framework, the Spring framework is a framework based on IOC and AOP (aspect-oriented programming)[3] . IOC makes it easy to implement bean assembly, provides concise AOP and enables transaction management, but it does not have the ability to handle distributed applications. The central point of Spring is to support reusable business and data access objects that are not bound to a specific Java EE service. Such objects can be reused in different Java EE environments (Web or EJB), stand-alone applications, test environments, and persistent layer frames include hibernate and various JDO products, as well as Ibatis. Hibernate is an open source O/R mapping framework that has a very lightweight object package for JDBC and can be applied to any use of JDBC, replacing CMP in the Java EE framework of EJB application, and accomplishing the task of data persistence. Ibatis is a simple SQL Map tool that maps a hand-written SQL statement in an XML configuration file to a Java object.

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.