hello team, I need to create a spring rest api, is...
# server
n
hello team, I need to create a spring rest api, is there a cmd that can generate basic boiler files for me to fill in detail: controller, service dao etc
a
Not that I have seen, not all the way to Controller/Service/DAO. Initilizr will build the project for you - which is a goot step in the right direction: https://start.spring.io/
k
c
Hello, please, what is a DAO? Never heard of it. I have heard of DTO. But not DAO
a
Data Access Object...
Like a CrudRepository, but more manual-coding
c
How different is it from a DTO?
a
DTO = Data Transport Object... so DTO has no business or persistence logic. DAO has any/all of that
Well, not so much of business logic (unless you are in a rush/lazy) that should be in a Service layer. So DAO has persistence logic
Like a Repository
c
Oh, so like a repository, but does not exist in the repository classes?
a
No. Spring creates an ephemeral class for it, inferring everything needed from the Repository interface. The only time you'd make your own DAO these days is if you needed some ultra-specific control over the DB that Spring Data/JPA or Hibernate (or any other ORM) does not provide
DAO is old-school
c
Okay. Thank you for helping me cure my ignorance.