JavaBeans, ejb, and Pojo detailed

Source: Internet
Author: User
Tags jboss jboss server

Transferred from: http://developer.51cto.com/art/200906/130814.htm

As more and more learners of the Java ee, the technology of the Java EE is constantly developing, and the concepts are emerging, this article attempts to explain these concepts to the beginners from an easy-to-understand angle in order to grasp the learning direction of Java Ee.

First we need to know that Java and EE are two different concepts, Java does not just refer to a language, has represented another huge faction different from microsoft, so Java is sometimes referred to as a genre of software systems, of course, is now mainly. NET and Java two major mainstream System.

It can be said that Java in the database information System implementation, database information system from the early dbase, to DELPHI/VB and other c/s structure, the development to b/s (browser Browser/server server) structure, and the EE mainly refers to the implementation of B/S Structure.

The Java EE is also a framework and standard, the framework is similar to the concept of apis, libraries, but beyond Them. If you need a specific understanding of the framework, you can start with the design Pattern. The Java EE is a virtual big concept, theJava EE Standard mainly has three seed technical standard: Web technology, EJB technology and JMS, talk about the Java EE should say finally to implement to these three Sub-concepts.

Each of these three technologies involves two parts in the application: the container part and the application part , and theWeb container also refers to the Jsp/servlet container , if you want to develop a web application, whether it is compiled or run, Must have Jsp/servlet library or API support (in addition to jdk/j2se).

In addition to Jsp/servlet technology, Web technology requires JavaBeans or Java class to implement some functionality or packaging to carry data, so the Web technology was initially naked abbreviated to the Jsp/servlet JavaBeans System.

When it comes to JavaBeans technology, component-building technology (component) is a core part of java, and many software design concepts (design PATTERNS) are implemented through Javabeans.

JavaBeans is not part of the Java EE concept, if a JavaBeans object is called by Web technology (that is, jsp/servlet), then JavaBeans runs in the Java EE Web container, and if it is called by the ejb, it runs in the EJB container.

EJB (enterprise Javabeans) is an upgrade and specification of ordinary JavaBeans , because enterprise information system development needs a scalable performance and transaction, security mechanism, so as to ensure the smooth development of enterprise systems, rather than develop to a scale to replace a set of software Systems.

At this point, after the development of the JavaBeans component to ejb, it is not said that the former form of JavaBeans disappeared, which naturally formed two kinds of JavaBeans technology: EJB and Pojo,Pojo is completely different from the EJB concept, Refers to the ordinary javabeans, and this JavaBeans does not attach to a certain framework, or simply can say: this JavaBeans is you created for the application of the individual Development.

There are a lot of Java EE application development tools: such as jbuilder, eclipse, and so on, these Ides are first and foremost the development tools, that is to say, their primary function is to develop JavaBeans or Java class, but if you want to develop a EE system, Be implemented either as a Web or EJB technology, then it is possible to have specialized module functions (such as eclipse requires Lomboz plug-ins), and most importantly, because the Java EE system is differentiated into two parts for containers and applications, It is necessary to specify a Java EE container to develop a Java EE in any development tool.

The Java EE container is divided into web containers and EJB containers, Tomcat/resin is a web container, and JBoss is the EJB container Web container, in which the Web container is implemented directly using Tomcat. So the Web application you develop can run on both of these containers, and the Web EJB application you develop can only run on the JBoss server, and the commercial product websphere/weblogic and JBoss are the Same.

The Java EE container is also known as the Java EE server, and most of the time their concepts are consistent.

If your Java EE application database connection is obtained through jndi, that is, from the container, then your Java EE application System is basically independent of the database, if you in your Java EE application system coupled with the database JDBC driver configuration, Then your Java EE application system has a database concept color, as a mature need to promote the Java EE application system, not recommended and specific database coupling, of course, How to ensure that the operation of the Java EE Application System performance is reflected in your design level.

The criteria for measuring the level of design and development of the Java EE Application System are: decoupling; can your application be completely detached from each other? is not dependent on each other, but only in this way, can embody the maintainability, scalability of the software design Goals.

To achieve this, a variety of framework concepts are born, and the Java Framework standard divides a system into a major part of the web and ejb, although we are sometimes not differentiated by this specific technology, but rather from a design abstraction to a presentation layer, a service layer, and a persistence layer, which separates the Java EE from a height of three levels. For decoupling Purposes.

therefore, our actual programming, but also to their own functions to these three levels, so that the general direction clear, distinct, But there is no technical constraints to do this is not easy to do this, so we still have to rely on the technology of the Java EE to achieve, at this time, you can use the EJB specification to implement the service layer and the persistence layer, Web technology to achieve the performance layer;

Why EJB can separate the service layer from jsp/servlet, because it has a mandatory constraint on the JavaBeans encoding, there is now a weak constraint on javabeans, using the IOC pattern (OF course, EJB 3.0 also took this way), before the advent of the IOC model, Generally through the factory model to JavaBeans constraints, forming a service layer, which is jive such an open-source forum design principles.

thus, separating the service layer from the presentation layer now has two alternative architectural options: governing the common JavaBeans (POJO) framework (such as spring, jdonframework), and the EJB framework that governs ejbs, because ejbs are not just frameworks, or standards, And the standard can expand development, so, These two differences may be blurred in the future, and be incorporated into the same Standard. however, the individual believes That: standard-setting is to serve a purpose, the total sacrifice of some in exchange for some other, so the two architectures will co-exist for a long time.

These two architectural differences have also been born a new term: the completely pojo system is also called the lightweight system (lightweight), in fact, the noun itself does not have a strict definition, more is an attractive sign, light weight is easy to learn easy to use it? According to this definition, the Light-weight spring and other systems are not easy to learn, and EJB 3.0 (still called Ejb) after the system can be called lightweight it?

Before talking about the service layer framework, the service layer framework can be used to separate JavaBeans from the jsp/servlet, while the use of the presentation framework can completely separate the remaining JavaBeans in the jsp, this Part JavaBeans is mainly responsible for the display of correlation, Generally through the tag library (taglib) implementation, different frameworks have their own tag library, struts is a relatively broad application of a performance layer Framework.

thus, the separation between the presentation layer and the service layer is achieved through two frameworks, the remainder is the persistence layer framework, and the persistence layer framework separates the database storage from the service layer for its purpose, and the persistence layer framework has two orientations: write SQL statements such as JDBC (such as Ibatis) directly, using the O/R Hibernate and JDO Technologies implemented by mapping technology; and, of course, entity Bean Technology in EJBS.

The persistence layer framework is now blossoming, each with its pros and cons, so just like the presentation framework, No framework is designated as a standard frame now, and of course, the presentation framework now comes out of a jsf, which represents the concept of the page component as a new direction, but the complexity of the implementation is somewhat Forgotten.
While Sun has played a big role in all of these techniques, it is generally said that there is an evaluation on the web: Sun's theory is invincible; Sun's products are used to wall up, and for beginners, those who try to pass through or have passed Sun certification, quickly get rid of Sun's shadow , immediately take off, use the open source field of products to implement their own application System.

finally, If your Java EE application system is implemented using the above mentioned presentation layer, service layer, and persistence layer framework, You can also develop a high-quality application system without having to grasp the design pattern deeply.

It is also important to focus on: the development of a high-quality Java EE system also requires the correct business needs to understand, then domain modeling provides a more practical way to understand the business needs correctly, the relevant specific knowledge from the UML perspective of the combination of understanding.

of course, If you want to design your own industry framework, then the first step is to start with the design pattern, because design patterns provide you with a way to implement a decoupling reference implementation between JavaBeans or classes, and when you learn to decouple the System's basic unit JavaBean or classes, decoupling between the system modules you may be able to grasp , then you can achieve the refinement of the industry framework, which is another direction of Development.

The above ideas can be summed up as a sentence:

Java EE develops three pieces of treasure: domain model, patterns (schema), and framework (framework).

JavaBeans, ejb, and Pojo detailed

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.