The typical Java three layer structure is divided into the representation layer, the middle layer (business logic level) and the data service layer. The three-tier system deals with business rules, data access, and legitimacy checks in the middle tier. Instead of interacting directly with the database, the client establishes a connection to the middle tier through the component and then interacts with the database by the middle tier. Performance layer is the traditional JSP technology, since its inception in 1999, after years of development, its wide application and stable performance, as a performance layer of technology has laid a solid foundation. The middle layer adopts the popular spring+hibernate, in order to separate the control layer and the business logic layer, it is subdivided into the following several. The web layer, the "C" (Controller) in the MVC pattern, is responsible for controlling the interaction of the business logic layer with the presentation layer, invoking the business logic layer, and returning the business data to the performance layer for organizational performance, and the MVC framework of the system uses struts. The service layer (the business logic layer) is responsible for implementing the business logic. The business logic layer is based on the DAO layer, and the business logic required by the system is completed by wrapping the front pattern of DAO components.
the DAO layer, which is responsible for interacting with persisted objects. This layer encapsulates the operation of adding, deleting, checking and changing data. PO, persistent object. By mapping the data of the relational database into objects through the Entity Relationship Mapping tool, it is easy to implement the database in object-oriented mode, which uses Hibernate as the ORM framework. Spring's role spans the entire middle tier, seamlessly consolidating the web layer, service layer, DAO layer, and Po, and its data service layer is used to store data.
A good framework allows developers to mitigate the burden and effort of re-establishing solutions to complex problems; it can be extended for internal customization, and has a strong user community to support it. A framework is usually a good solution to a problem. However, your application is layered, and each layer may need its own framework. Just solving the UI problem does not mean that you have a good coupling between business logic and persistence logic and UI components.
Admittedly , for a simple application, the development efficiency of using ASP or PHP is higher than the development efficiency of the Java EE framework. There are even people who think that this layered structure is less efficient than a system that generally uses JSP + servlet.
The use of excellent decoupling architecture. This architecture is the layered architecture of the Java EE, in a good layered architecture, the control layer relies on the business logic layer, but not with any specific business logic components, only coupled with the interface, similarly, the business logic layer depends on the DAO layer, and will not be coupled with any specific DAO components, but interface-oriented programming. The software is implemented in this way, even if parts of the software change, and the rest of the parts are not changed as much as possible.
The biggest benefit of using hibernate as a persistence layer technique is that it can be used to analyze and design the system completely in object-oriented way.
The DAO pattern requires the DAO interface to be written for each DAO component, with at least one implementation class, and possibly multiple implementation classes depending on the needs.
Replace the DAO factory with a spring container.
In general, the introduction of interfaces inevitably requires the introduction of a factory to be responsible for the generation of DAO components. Spring implements two basic modes: the single-state mode and the factory-mode. With spring, you can avoid using Factory mode entirely, because spring is a very powerful factory. Therefore, it is entirely possible for spring to act as a DAO factory.
When spring serves as a DAO factory, it is not necessary for the programmer to implement the Factory mode by itself, only the DAO component is configured in the Spring container, and the ApplicationContext is responsible for managing the creation of DAO components. With the dependency injection provided by spring, other components do not even have to access the factory, and can use DAO instances directly.
SSH Frame Selection