Some time I participated in the project using Struts, Ibernate. Today, the project has ended, and the design of multi-layer systems has some understanding. This project is mainly realized and this article - combines struts and hibernate to talk about J2EE architecture Said, telling the story. You can browse first, I mainly want to discuss the VO. The data representation of the web layer is formbean, data from the HTML Form Post business layer is the data representation of the VO persistence layer. Po, its data is derived from the database, and the data of the persistence layer indicates that, for example, the structure of the CMP general system is like this. Action (web control) ---> business bean ---> Dao ---> ORM ---> DB, It can be seen that the role of Vo is to pass the data from the DAO layer to the action, or the action is passed to DAO, in fact, formbean ---> Vo ---> Po, or Po ----> Vo ---- > Formbean. Of course, if you want Robbin, a lot of systems like to save VO, directly let PO pass to FORMBEAN, or pass a PO in Action, passing the PO to DAO, which is also possible, mainly because Hibernate is powerful, PO can be separated from the persistence layer, it is not possible like JDO, so when planning the system, you must consider whether your system is maintained after maintenance, if you can change your lasting layer product, if Maybe Vo is still needed, otherwise you will modify it very painful. Of course, the VO is really cool, our system is like this, more convenient, no need to maintain an VO, the efficiency is certain, but also There is a question to note is the design of the database. Generally, in object-oriented programming, the database should use object-oriented ideological design, but this many system design is not able to do, or the old system cannot change. The problem is that the design is unreasonable, and there will be a lot of fields. Of course, the corresponding PO will be large, but sometimes some information is not that the layers need to pass, and it is definitely losing. So this time you can use Vo, VO size can of course customize, especially when querying data, there is a certain increase in efficiency.
This is my little understanding, I hope everyone will discuss it.