The use of VO and PO for Java

Source: Internet
Author: User

Recently engaged in a project, the use of SPRINGMVC, deepened my understanding of VO and po, feeling and hair.

1 Tips for writing before

VO = = Value Object

PO = = Persistant Object

Vo corresponding to the page, PO corresponding entity/relational mapping

2 in your program, if you do not have VO, then it is likely that your program is not designed with object-oriented thinking, or you think of the PO as VO at the same time.

Entity:

Order {

Id

CreateDate

}

When the order creation time filter is required on my page, there are two ways, one is non-object-oriented design, the other is to add Createdatestart, Createdateclose in the PO, that is

Order {

Id

CreateDate

Createdatestart

Createdateclose

}

This time is Order even if PO is VO

Why not use a more elegant design

Ordervalueobject {

Id

Createdatestart

Createdateclose

}

  

Orderpersistenceobject {

Id

CreateDate

}

Isn't it clearer and more elegant? What the? Is the code very high? Oh, my friend, don't you know there's a code generator for this thing?

The use of VO and PO for Java

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.