Giter Club home page Giter Club logo

Comments (2)

underdarks avatar underdarks commented on June 23, 2024

안녕하세요! 먼저 좋은 글 제공해주셔서 감사합니다.
현재 JPA + Boot를 사용하면서 프로젝트 진행 중 궁금한게 있어서 질문드려요

1.맨 마지막 create 부분에 SignUpReq 가 DTO이고 Account가 엔티티인거 맞나요?
2.그러면 DTO에서 Account Entity를 생성(toEntity) 후 리턴하는식으로 설계하신건가요?

  • 그 반대로인 Accout 엔티티에서 DTO를 받아 빌더 패턴을 통해 객체를 생성하는 방식은 어떻게 생각하시나요?

감사합니다!

from blog-comment.

cheese10yun avatar cheese10yun commented on June 23, 2024

@underdarks

1.맨 마지막 create 부분에 SignUpReq 가 DTO이고 Account가 엔티티인거 맞나요?

네 맞습니다.

2.그러면 DTO에서 Account Entity를 생성(toEntity) 후 리턴하는식으로 설계하신건가요?

네 맞습니다.

그 반대로인 Accout 엔티티에서 DTO를 받아 빌더 패턴을 통해 객체를 생성하는 방식은 어떻게 생각하시나요?

각 프로젝트 마다 성격이 다르기 떄문에 좋다 나쁘다 라고 말하기는 어렵겠지만 DTO -> Enttiy를 만드는게 더 좋다고 생각합니다.

API 애플리케이션 같은 경우 DTO는 Request Body와 같은 웹요청에 대한 DTO 객체가 나올텐데요. 그러면 컨트롤러 계층에 있는 DTO들이 도메인 객체까지 들어오기 때문에 반대 방향으로하는 것을 선호 합니다.

from blog-comment.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.