<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>devkuma – Entity</title>
    <link>https://www.devkuma.com/en/tags/entity/</link>
    <image>
      <url>https://www.devkuma.com/en/tags/entity/logo/180x180.jpg</url>
      <title>Entity</title>
      <link>https://www.devkuma.com/en/tags/entity/</link>
    </image>
    <description>Recent content in Entity on devkuma</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <managingEditor>kc@example.com (kc kim)</managingEditor>
    <webMaster>kc@example.com (kc kim)</webMaster>
    <copyright>The devkuma</copyright>
    
	  <atom:link href="https://www.devkuma.com/en/tags/entity/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>DTO, VO, Entity</title>
      <link>https://www.devkuma.com/en/docs/dto-vo-entity/</link>
      <pubDate>Tue, 06 Jul 2021 11:04:23 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/dto-vo-entity/</guid>
      <description>
        
        
        &lt;h2 id=&#34;what-is-a-dtodata-transfer-object&#34;&gt;What Is a DTO(Data Transfer Object)?&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;DTO means an object used to transfer or move data.&lt;/li&gt;
&lt;li&gt;It is an object(Java Beans) for exchanging data between layers.
&lt;ul&gt;
&lt;li&gt;It refers to an object used when data retrieved from a DB is sent to a Service, Controller, and so on.&lt;/li&gt;
&lt;li&gt;It is a pure data object without logic and has only Getter and Setter methods.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;what-is-a-vovalue-object&#34;&gt;What Is a VO(Value Object)?&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;VO(Value Object) literally means a value object.&lt;/li&gt;
&lt;li&gt;It guarantees object immutability, meaning the object&amp;rsquo;s information does not change.
&lt;ul&gt;
&lt;li&gt;It may only have Getter methods.&lt;/li&gt;
&lt;li&gt;Values can be set through a constructor, and using the Builder pattern is convenient in this case.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Even if VO instances have different names, if all their property values are the same, the two instances can be considered the same object.
&lt;ul&gt;
&lt;li&gt;For this, a VO must override the &lt;code&gt;equals()&lt;/code&gt; and &lt;code&gt;hashcode()&lt;/code&gt; methods of the Object class.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;A VO is judged to be the same object only when all values of the properties(fields) declared inside the VO are equal for each VO object.&lt;/li&gt;
&lt;li&gt;It can have additional properties beyond the columns in a table.&lt;/li&gt;
&lt;li&gt;A BaseVO class that collects common properties for multiple tables(A, B, C) can also be inherited and used.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;what-is-an-entity&#34;&gt;What Is an Entity?&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;An Entity is an object mapped to an actual DB table.&lt;/li&gt;
&lt;li&gt;It means a collection of data.&lt;/li&gt;
&lt;li&gt;It is data that must be stored and managed.&lt;/li&gt;
&lt;li&gt;It refers to concepts, places, events, and similar things.&lt;/li&gt;
&lt;li&gt;It refers to tangible or intangible subjects.&lt;/li&gt;
&lt;li&gt;Each Entity must be distinguished by an ID and must have a unique identifier.
&lt;ul&gt;
&lt;li&gt;ID, member number, and so on.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;It must have at least one property.
&lt;ul&gt;
&lt;li&gt;Name, address, and so on.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;It is a set of instances that exist persistently.&lt;/li&gt;
&lt;li&gt;It must be information that is necessary and managed in the relevant business domain.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;summary&#34;&gt;Summary&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;DTO is an object used to move data between layers.&lt;/li&gt;
&lt;li&gt;VO is a pure domain object that has values.&lt;/li&gt;
&lt;li&gt;Entity is an object that maps those values to a DB table.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/dto-vo-entity/layer.png&#34; alt=&#34;Layer separation&#34;&gt;&lt;/p&gt;

      </description>
      
      <category>dto</category>
      
      <category>vo</category>
      
      <category>entity</category>
      
    </item>
    
  </channel>
</rss>
