Java Tiered Development

Source: Internet
Author: User

1. What is a three-tier architecture:

The three-tier architecture is divided into: Action--service (biz)--dao

The DAO layer uses Hibernate to connect to the database, to manipulate the database (add and revise).

Service (Biz) layer: Refers to the corresponding DAO database operation, where you can write your own code (such as simple judgments).

Action layer: refers to the corresponding service (BIZ) layer, where the combination of struts configuration file, jump to the specified page, of course, can also accept the page to pass the request data, can also do some calculation processing.

All of the above hibernate,struts need to be injected into spring's configuration file, and spring links these together to become a whole.

2. Benefits of using tiering:

1. Decoupling between software is realized
2. Ease of Division
3. Easy Maintenance
4. Improve the reuse of software components
6. Easy to expand the product function.
7. Easy to adapt to the changing needs of users

3.java (Po,vo,to,bo,dao,pojo) explanation

PO (Persistant object) Persistent objects:
The concept that occurs at the O/R mapping, without the O/R mapping, does not exist. Usually the corresponding data model (database), itself also has some business logic processing. Can be seen as a Java object mapped to a table in the database. The simplest PO is a record in a table in the corresponding database, and multiple records can be used with a collection of PO. The PO should not contain any operations on the database.

VO (Value object) value objects:
typically used for data transfer between business tiers, as is the case with PO, which contains only data. But it should be abstracted out of the business object that can correspond to the table, or not, depending on the needs of the business. Personally feel the same DTO (data transfer object) that is passed on the web.

to (Transfer object), data transfer object:
objects that are transferred between different tie (relationships) in the application

BO (business object) service object:
from the business model perspective, see the domain objects in the UML component Domain model. A Java object that encapsulates the business logic, by invoking the DAO method and combining Po,vo for business operations.

POJO (Plain ordinary Java object) simple, rule-free Java objects:
Java objects that are purely traditional in meaning. In some object/relation mapping tools, the Persisent object that maintains database table records is a pure Java object that conforms to the Java Bean Specification and does not add other properties and methods. My understanding is the most basic Java Bean, only attribute fields and setter and getter Method!.

DAO (data Access Object) Access objects:
is a sun's standard Java EE design pattern, which has an interface that is DAO, which has negative persistence layer operations. Provides interfaces for the business layer. This object is used to access the database. Usually used in conjunction with PO, DAO contains various methods of operation of the database. Through its method, combine the PO to carry on the related operation to the database. Sandwiched between business logic and database resources. With VO, provide database crud operations ...

O/R Mapper object/relationship mapping: 
after defining all the mapping, this O/R mapper can help us do a lot of work. With these mappings, this O/R mapper can generate all the SQL statements about the object save, Delete, read, and we no longer need to write so many lines of DAL code.

Java Tiered Development

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.