Skip to content

Spring Boot + Mysql+ Hibernate +Spring Data JPA

Notifications You must be signed in to change notification settings

15702992009/blog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mysql

  1. jdbc:mysql://localhost/blog?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC

Hibernate

  1. JPA vs. Hibernate : https://www.javatpoint.com/jpa-vs-hibernate#:~:text=Hibernate-,JPA,It%20is%20just%20a%20specification.

JWT

Spring Security

build this blog

What is the difference between an MVC Model object, a domain object and a DTO

What is the difference between a MVC Model object, a domain object and a DTO?

My understanding is:

MVC Model object:

Models the data to be displayed by a corresponding view. It may not map directly to a domain object, i.e. may include data from one or more domain objects.

Client side May contain business logic. Eg. validations, calculated properties, etc No persistence related methods Domain object:

An object that models real-world object in the problem domain like Reservation, Customer, Order, etc. Used to persist data.

Server side No business logic DTO (Data Transfer Object):

An object used to transfer data between layers when the layers are in separate processes, e.g. from a DB to a client app. Allows a single transaction across the wire rather than multiple calls when fetching data corresponding to multiple domain objects. A DTO contains just data and accessor methods and there is no logic present. The data is for a particular DB transaction, so it may or may not directly map to a domain object as it may include data from one or more domain objects.

Used on both server and client sides as it is passed between layers No business logic No persistence related methods So, the questions:

Is above understanding correct? Am I missing some key points?

Are there any reasons not to use Domain objects as the MVC Model assuming that the Model objects do not require extra business logic?

Are there any reasons not to use DTOs as the MVC Model assuming that the Model objects do not require extra business logic?

About

Spring Boot + Mysql+ Hibernate +Spring Data JPA

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages