What are PO, VO, DAO, BO and POJO respectively? (Explanation of several JAVA objects)
PO: persistent object persistent object The most vivid understanding is that a PO is a record in the database. The advantage is that a record can be processed as an object and can be easily converted into other objects. It can be seen as a Java object that maps to a table in the database. The simplest PO corresponds to a record in a table in the database. Multiple records can use a collection of POs. The PO should not contain any operations on the database. BO: business object business object Java objects that encapsulate business logic can perform business operations by calling DAO methods and combining PO and VO. The main function is to encapsulate business logic into an object. This object can contain one or more other objects. For example, a resume has educational experience, work experience, social relations, etc. We can map educational experience to a PO, work experience to a PO, and social relationships to a PO. Create a BO object corresponding to the resume to process the resume. Each BO contains these POs. When dealing with business logic in this way, we can deal with BO. VO: value object value object, ViewObject presentation layer object…
VO, PO, etc. in Java
O/R Mapping is the abbreviation of Object Relational Mapping. In layman’s terms, it means binding objects to relational databases and using objects to represent relational data. In the world of O/R Mapping, there are two basic and important things to understand, namely VO and PO. VO, Value Object (Value Object) PO, Persistent Object (Persisent Object) They are composed of a set of properties and their get/set. Structurally, there is nothing different about them. But it is completely different in its meaning and essence. 1. VO Created by the new keyword and recycled by GC PO Created when new data is added to the database, and deleted when data in the database is deleted. And it can only survive in one database connection and will be destroyed when the connection is disconnected. 2. VO is a value object. To be precise, it is a business object. It lives in the business layer and is used by business logic. The purpose of its existence is to provide a place for data to live. PO is stateful, and each attribute represents its current state. It is an object representation of physical data. Using it, we can decouple our programs from physical data and…
1.Entity classes Entity, Bo, Vo, Po, Dto, Pojo, Dao in java
Entity The most commonly used entity class basically corresponds to the data table one-to-one – one entity and one table. Bo (business object) means business object. Bo is to encapsulate business logic into an object. Note that it is logic. Business logic. This object can include one or Multiple other objects. Perform business operations by calling the Dao method – combined with Po or Vo. Image is described as the form and action of an object – of course there are also some forms and actions related to other objects. For example, when dealing with a person’s business logic, the person will sleep, eat, work, go to work, etc. There may also be behaviors of having relations with others. When dealing with such business logic, we can deal with BO. For another example, the policyholder is a Po, the insured is a Po, the insurance type information is also a Po, etc. Their combination is the Bo of a policy. Vo (value object) represents the meaning of value object – usually used for data transfer between business layers – created by new – recycled by GC. Mainly reflected in the object of the view – for a WEB page, the…
dto conversion vo_java development between DTO, VO, PO, you should do this
Painpoints Theemergenceofaframeworkmustsolveapainpoint,IthinkthefollowingoneInconvenientoperationsareoftenwrittenbypeople. IftheCarclassisadatabasemappingclass CarDTOisaDTOclass Usuallywewillwriteamethodtoconvertlikethis p> Evenalotoftypeconversionsandcumbersomeoperationssuchasnestingareinvolved,andwewanttoAllthatisneededistoestablishthemappingrelationshipbetweenthem.Isthereageneralmappingtoolthatcanhelpusdoallthis?Ofcoursethereare,andtherearequiteafew.Somepeoplesaythatapache’s BeanUtil.copyProperties can achieve “but the performance is poor and prone to exceptions” and many specifications strictly prohibit the use of this approach. The following is a comparison of several object mapping frameworks – MapStruct has the highest performance in most cases. Similar to lombok, Mapstruct is implemented at compile time, so there is generally no runtime performance problem. so,Let’stryoutMapStructtoday.Whetheritisideaoreclipse,itisrecommendedtoinstallthemapstructplug-in. Installation Introducemavendependencycoordinates Writemapping Let’ssolvetheinitialpainpoint-writingthemappingfromCartoCarDTO. Declareamappinginterfacewiththe@org.mapstruct.**Mappertag,indicatingthatthisisAbeanconversioninterface.HerewedeclareaCAR_MAPPINGtofacilitateustocall”CarDTOtoCarDTO(Carcar),areyoufamiliar?”toabstractourconversionmethodlikemybatis.Theorg.mapstruct.Mappingannotationisusedtodeclarethemappingofmemberattributes.Thisisbasedontheparameternameofthemembervariable.Ifthereisnesting,forexample,thereisamembervariabletypeofCarTypetypeinCar,itstypeattributemapsthetypestringinCarDTO.Weusetype.typetogettheattributevalue.Iftherearemultiplelayers,soon.mapStructultimatelycallsthesetterandgettermethodsinsteadofreflection.Thisisoneofthereasonswhyitsperformanceisrelativelygood.ItiseasiertounderstandthatnumberOfSeatsmapstoseatCount.Didweforgetanattributemake,becausetheirpositionsandnamesareexactlythesame,sotheycanbeomitted.Moreover,thepackagingclassisautomaticallyunboxedandsealed,andisthread-safe.MapStructnotonlyhasthesefunctions,butalsohassomeothercomplexfunctions: Setconversiondefaultvaluesandconstants.Whenthetargetvalueisnullwecansetitsdefaultvalue,Notethatthesearebasictypesandcorrespondingboxingtypes,asfollows @Mapping(target=”stringProperty”,source=”stringProp”, defaultValue = “undefined”) It should be noted that constants cannot reference the source (the source attribute cannot be specified),The following is Correct operation @Mapping(target = “stringConstant”, constant = “Constant Value”) Formatting is also an operation we often use ,Such as number formatting ,Date formatting. This is an operation that handles number formatting,Follow the specifications of java.text.DecimalFormat @Mapping(source = “price”, numberFormat = “$#.00”) The following shows the formatting operation for mapping a date collection to a date string collection, @IterableMapping(dateFormat = “dd.MM.yyyy”) List stringListToDateList(List dates); We also often use spring component to handle our You only need to declare “No need to build a singleton” like this to reference CarMapping like other spring beans. Summary In fact, MapStruct has many functions. But in terms of readability,…
Differences and connections_Differences and connections between JavaBean, POJO, VO, and DTO
Preface: This article is compiled by the editor of Programming Notes#. It mainly introduces the differences and connections between JavaBean, POJO, VO, and DTO. I hope it will be of certain reference value to you. JavaBean is a reusable component written in JAVA language. To be written as a JavaBean, a class must be concrete and public, and have a parameterless constructor. JavaBeans expose member properties of internal fields by providing public methods that conform to consistent design patterns. As we all know, property names conform to this pattern, and other Java classes can discover and manipulate the properties of these JavaBeans through their own mechanisms. VO is value objectIt is mainly reflected in the object of the view. For a WEB page, the attributes of the entire page are encapsulated into an object. Then use a VO object to transmit and exchange between the control layer and the view layer. DTO (processed PO, which may increase or decrease the attributes of the PO):Data Transfer Object Data Transfer ObjectMainly used for remote calls and other applications that require a large number of transfer objects place. For example, if we have 100 fields in a table, then the corresponding PO will…
Examples of java business objects_PO, BO, VO, DTO, POJO, DAO concepts and their functions in Java and project example diagram (translated)…
PO (bean, entity, etc. naming): Persistant Object persistent object,The display status of the records in the database table in the java object Most The visual understanding is that a PO is a record in the database. The advantage is that a record can be treated as an object and can be easily converted to other objects. BO (named as service, manager, business, etc.): Business Object The main function is to encapsulate business logic into an object. This object can contain one or more other objects. Image is described as the form and action of an object – of course it also involves some forms and actions of other objects. For example, handling a person’s business logic – sleeping, eating, working, going to work, etc. There are also behaviors that may lead to relationships with others. When dealing with business logic in this way, we can deal with BO. VO (from also has this way of writing) : Value Object Mainly reflected in the object of the view,For a WEB page Encapsulate the properties of the entire page into an object. Then use a VO object to transmit and exchange between the control layer and the view layer. DTO (the processed…
JavaBean, bean, POJO, PO, DTO, VO, BO, EJB, EntityBean
What is JavaBean, bean? What is POJO, PO, DTO, VO, BO? What is EJB, EntityBean? Preface: We often encounter these conceptual problems in Java development. Some of them may be confused and some may not understand them well. I spent a lot of time to straighten them out. these concepts. However, some concepts are not used in actual development. “Maybe the understanding is not accurate enough” and can only be corrected in the future. 1. What is POJO? MacKenzie put it forward in a speech in 2000. According to Martin Fowler’s explanation, it is “Plain Old Java Object” – literally translated as “pure old-fashioned Java object” – but everyone uses “simple java object” to refer to it. it. The intrinsic meaning of POJO refers to “those Java objects that do not inherit any class or implement any interface” and have not been invaded by other frameworks. Let’s give a definition first: POJO is a simple, ordinary Java object,it contains business logic processing or persistence logic, etc.,but it is not a JavaBean , EntityBean, etc. “do not have any special role” and do not inherit or implement any other Java framework classes or interfaces. Can contain similar JavaBean properties and setter…
vo, dto, dao transfer in java
O is the mapping to the table in the database, one table corresponds to one VO DAO uses VO to access the real table, and all operations on the database are completed in DAO BO is the business layer, doing Logically processed VO, PO, BO, QO, DAO, POJO, O/R Mapping is the abbreviation of Object Relational Mapping. In layman’s terms, it means binding objects to relational databases and using objects to represent relational data. In the world of O/R Mapping, there are two basic and important things that need to be understood, namely VO and PO. VO, Value Object, PO, persistent objects (Persisent Object), they are composed of a set of properties and their get and set methods. Structurally, there is nothing different about them. But it is completely different in its meaning and essence. 1. VO is created using the new keyword and recycled by GC. PO is created when new data is added to the database and deleted when data in the database is deleted. And it can only survive in one database connection and will be destroyed when the connection is disconnected. 2. VO is a value object. To be precise, it is a business object. It…
Concepts of PO, BO, VO, DTO, POJO, DAO in Java and their functions and project example diagram (translated)
PO (bean, entity, etc. naming): Persistant Object, the display status of records in the database table in the java object The most vivid understanding is that a PO is a record in the database. The advantage is that a record can be processed as an object and can be easily converted to other objects. BO (naming of service, manager, business, etc.): Business Object The main function is to encapsulate business logic as an object. This object can contain one or more other objects. Image is described as the form and action of an object. Of course, it also involves some forms and actions of other objects. For example, when dealing with a person’s business logic, there are behaviors such as sleeping, eating, working, going to work, etc. There are also behaviors that may lead to relationships with others. When dealing with business logic in this way, we can deal with BO. VO (from is also written this way): Value Object Mainly reflected in the object of the view, for a WEB The page encapsulates the properties of the entire page into an object. Then use a VO object to transmit and exchange between the control layer and the view layer.…
Java data object use: PO, DO, TO, DTO, VO, BO, DAO, POJO concept explanation and use
class=”markdown_views prism-atom-one-dark”> PO: Persistent Object Persistent Object The display state of the records in the database table in the java object. The most vivid understanding is that a PO is a record in the database. A record can be treated as an object, and it can also be easily converted to other objects. If there is a piece of data in the database, a simple class is now given an instance of this data, then the existing state of this simple class is PO. (generally/temporarily not used) DO:Domain Object Domain Object Used to receive the entity corresponding to the database, it is an abstract data state, between the database and business logic. Generally, it is used when the Service accesses the database to receive data. Generally placed under the entity/domain package. (Common) TO:Transfer Object Data Transfer Object An object that is transferred between different relationships in the application. (generally/temporarily not used) DTO: Data Tranfer Object Data Transfer Object This concept comes from the J2EE design pattern, which is a method of transferring data between design patterns software application system. The data transferred by the data is generally the data retrieved by the data access object from the database. Generally refers…